hi,
I'm having a few problems, I am adapting this script in baby steps, and learning as I go.
Right now I have it collecting scans and writing (appending) to a file. What I wanted to do was have a user scan/enter an order number and then all subsequent scans would write to the file with the order number and UPC beside...
ORD1 772454051111
ORD1 772454050855
ORD1 883049178936
ORD1 883049128115
the problem is after each scan I want it to hold onto the order # and stay on the barcode field... so I don't lose the Order Variable.
I was trying to debug with a counter, but could not get my IF condition to work... just need a little guidance to get me in the right direction.
I know there is a lot missing from the code to make it better, but I am only focusing on this portion at the moment.
Thanks
Ziggy
I'm having a few problems, I am adapting this script in baby steps, and learning as I go.
Right now I have it collecting scans and writing (appending) to a file. What I wanted to do was have a user scan/enter an order number and then all subsequent scans would write to the file with the order number and UPC beside...
ORD1 772454051111
ORD1 772454050855
ORD1 883049178936
ORD1 883049128115
the problem is after each scan I want it to hold onto the order # and stay on the barcode field... so I don't lose the Order Variable.
I was trying to debug with a counter, but could not get my IF condition to work... just need a little guidance to get me in the right direction.
I know there is a lot missing from the code to make it better, but I am only focusing on this portion at the moment.
Code:
#!/bin/sh
#--------------------------------------------
# Author: Ziggy
# Date : January 18 2011
# RF scanning
#--------------------------------------------
# Main Variables Definition
LOGO="RF Scan Menu"
bold=`tput smso`
offbold=`tput rmso`
counter=1
#------------------------------------------------------
# MAIN MENU PROMPTS
#------------------------------------------------------
amenu="Type exit to close";
#------------------------------------------------------
# MAIN Routine
#------------------------------------------------------
# trying to use to debug and count loop... gives error for...bracket }
#% if ($counter > 1 ) {
#% break
#% }
mainframe () {
clear
tput cup 3 1; echo xxxxxxxxxxxxxxxxxxxxx
tput cup 4 1; echo x; tput cup 4 21; echo x
tput cup 5 1; echo xxxxxxxxxxxxxxxxxxxxx
tput cup 9 5; echo Scan Barcode
}
themenu () {
tput cup 0 4; echo "${bold} Company Name ${offbold}"
tput cup 1 5; echo "${bold} $LOGO ${offbold}\n"
tput cup 4 2; echo $amenu;
tput cup 9 0; echo $MSG
# position of field to scan into
tput cup 8 3; echo "Order: "
tput cup 10 2; echo "Scan: "
tput cup 8 10; read ORDN
}
#------------------------------------------------------
# MAIN LOGIC
#------------------------------------------------------
#MSG=
while true
do
mainframe
themenu
tput cup 10 10; read answer
# MSG=
case $answer in
exit) clear;break;;
*)echo $ORDN $answer >> /home/zigsto/ScanTest2.txt;;
esac
counter=$(echo "$counter +1" | bc)
#break
done
print $counter
Thanks
Ziggy