Hi all,
I am new to cgi and perl, i have a small script which i wrote in Korn shell programming. I heard cgi and perl is very powerfull but i am not sure they can rewrite what i have in shell programing and can use cgi and perl to work on website or not. can you help me to rewrite it in cgi so i can learn and use it on web?
Thank you very much.
=======================
#!/bin/ksh
#############################################################################
#
# This script will be helpful to us because it will check for
# any bad (part number-serial number) with at least 15 numbers when scanned.
# If the serail number is on the bad SN list it will be written to
# a file called found_fail.txt. If it is not in the bad SN list it will
# write to found_good.txt.
# It also checks for the correct part number and any duplicate part
# number that has been scanned. It compares the SN in a file called scanned.lst.
# We need to edit the part number, so it can check for a correct part number
# while making sure the bad SN list is saved as badsn.txt.
#
#
##############################################################################
while :
do
echo "Enter serial number [0 to quit]: \\c"
read serial
if [ $serial -eq 0 ]
then
break
fi
echo "$serial" | grep "^[0-9]...........[0-9]$" >> /dev/null
if test $? -ne 0
then
echo " !!! ERROR !!! Serial number must be 13 digits long. Please try again."
continue
fi
echo "$serial" | grep 501XXXX >> /dev/null
if test $? -ne 0
then
echo " INVALID serial (must have 501XXXX prefix)! Please try again."
continue
fi
if [ ! -f scanned.lst ]
then
touch scanned.lst
fi
cat scanned.lst | grep $serial >> /dev/null
if test $? -eq 0
then
echo " ALREADY SCANNED - No further action is to be performed."
continue
else
echo $serial >> scanned.lst
fi
cat badsn.txt | grep $serial >> /dev/null
if test $? -eq 0
then
echo " BAD Serial Number found: <$serial>"
echo $serial >> found_fail.txt
continue
else
echo " GOOD Serial Number. OK, pass!"
echo $serial >> found_good.txt
continue
fi
done
I am new to cgi and perl, i have a small script which i wrote in Korn shell programming. I heard cgi and perl is very powerfull but i am not sure they can rewrite what i have in shell programing and can use cgi and perl to work on website or not. can you help me to rewrite it in cgi so i can learn and use it on web?
Thank you very much.
=======================
#!/bin/ksh
#############################################################################
#
# This script will be helpful to us because it will check for
# any bad (part number-serial number) with at least 15 numbers when scanned.
# If the serail number is on the bad SN list it will be written to
# a file called found_fail.txt. If it is not in the bad SN list it will
# write to found_good.txt.
# It also checks for the correct part number and any duplicate part
# number that has been scanned. It compares the SN in a file called scanned.lst.
# We need to edit the part number, so it can check for a correct part number
# while making sure the bad SN list is saved as badsn.txt.
#
#
##############################################################################
while :
do
echo "Enter serial number [0 to quit]: \\c"
read serial
if [ $serial -eq 0 ]
then
break
fi
echo "$serial" | grep "^[0-9]...........[0-9]$" >> /dev/null
if test $? -ne 0
then
echo " !!! ERROR !!! Serial number must be 13 digits long. Please try again."
continue
fi
echo "$serial" | grep 501XXXX >> /dev/null
if test $? -ne 0
then
echo " INVALID serial (must have 501XXXX prefix)! Please try again."
continue
fi
if [ ! -f scanned.lst ]
then
touch scanned.lst
fi
cat scanned.lst | grep $serial >> /dev/null
if test $? -eq 0
then
echo " ALREADY SCANNED - No further action is to be performed."
continue
else
echo $serial >> scanned.lst
fi
cat badsn.txt | grep $serial >> /dev/null
if test $? -eq 0
then
echo " BAD Serial Number found: <$serial>"
echo $serial >> found_fail.txt
continue
else
echo " GOOD Serial Number. OK, pass!"
echo $serial >> found_good.txt
continue
fi
done