Computing.Net > Forums > Linux > shell scripting

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

shell scripting

Reply to Message Icon

Name: vishab
Date: October 3, 2000 at 10:07:04 Pacific
Comment:

my program is as follows
echo -n "Enter SSN or q to quit:\c"
read SSN
while [ $SSN != q ]
do
# find the record
grep $SSN personal # filename personal
if [ $? -ne 0 ]
then
echo "Record does not exist"
else
#Allow the user to make changes
#read does not read fieild ssn ln fn
grep $SSN personal |tr ':' ' '|read ssn ln fn
old_ssn=$SSN
#provide menu to make changes
echo "what ( s-ssn, l-ln, f-fn, q - quit):\c"
read answer
while [ $answer != q ]
do
case $answer in
s) echo "Enter SSN:\c"
read ssn ;;
l) echo "Enter ln:\c"
read ln ;;
f) echo " Enter fn:\c"
read fn ;;
*) echo "not supported choice" ;;
esac
echo $SSN:$ln:$fn
echo " what ( s - ssn, l - ln, f - fn , q -quit ):\c"
read answer
done
#remove old record
grep -v $old_ssn personal > temp
mv temp personal
# insert new one
echo $ssn:$ln:$fn >> personal
fi
echo "Enter ssn or q to quit:\c"
read ssn
done

# the problem with the script is that it does not allow me to make changes to the old ssn instead it prompts maybe my read mode is not working.......... please help me i am using mandrake 7.0 and am a newbeeeeeeee.




Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Linux Forum Home


Sponsored links

Ads by Google


Results for: shell scripting

Shell Script Question www.computing.net/answers/linux/shell-script-question/15096.html

Using Mailto in shell scripts www.computing.net/answers/linux/using-mailto-in-shell-scripts/27632.html

Bourne Shell Script Problem www.computing.net/answers/linux/bourne-shell-script-problem/19777.html