I want to port some unix scripts to perl, mostly for the fun of it. If anyone is kind enough could you help me convert this stuff. Converting these two functions should give me enough of a feel for it to do the rest.
#!/bin/sh
##################
# USAGE_function #
##################
USAGE_function (){
if [ $1 != 1 ]
then
echo "usage: $1 date"
exit 1
fi
}
######################
# RUNREPORT_function #
######################
RUNREPORT_function (){
YEST=`nawk 'BEGIN { FS = "," } ; $1 == '"$DATE2"' && $3 == "ERROR" { print $5, "\n" }'< $REPORT_LOG`
if [ $YEST ]
then
/use/bin/echo "$YEST" > /tmp/fast$$
/use/bin/echo "Hit RETURN to exit" >> /tmp/fast$$
(
/usr/openwin/bin/cmdtool -Wp 550 450 -Ws 600 300 -fg black -bg red -font r14 -label " Disk Cleanup Error " "$scripts/rep.sh" "/tmp/fast$$"
/usr/bin/rm /tmp/fast$$
)
fi
}
DATE2=$1
RUNREPORT_function
USAGE_function $#
Exit 0
#!/bin/sh
##################
# USAGE_function #
##################
USAGE_function (){
if [ $1 != 1 ]
then
echo "usage: $1 date"
exit 1
fi
}
######################
# RUNREPORT_function #
######################
RUNREPORT_function (){
YEST=`nawk 'BEGIN { FS = "," } ; $1 == '"$DATE2"' && $3 == "ERROR" { print $5, "\n" }'< $REPORT_LOG`
if [ $YEST ]
then
/use/bin/echo "$YEST" > /tmp/fast$$
/use/bin/echo "Hit RETURN to exit" >> /tmp/fast$$
(
/usr/openwin/bin/cmdtool -Wp 550 450 -Ws 600 300 -fg black -bg red -font r14 -label " Disk Cleanup Error " "$scripts/rep.sh" "/tmp/fast$$"
/usr/bin/rm /tmp/fast$$
)
fi
}
DATE2=$1
RUNREPORT_function
USAGE_function $#
Exit 0