Hello~ I've been trying to crack my head solving this for half a day.
INPUT=lookup.txt
IFS=":"
while read vTitle vAuthor vPrice vStock vSold
do
tempString="$vTitle:$vAuthor:$vPrice:$vStock:$vSold"
#echo "$tempString"
while [ "$iTitle" == "$vTitle" ]; do
./testcase.sh
done
done < $INPUT
Testcase.sh contains a script for a sub-menu. When I run this script, my sub-menu keeps repeating, as in a recursive loop. Any idea how to solve this issue? EDIT# Sorry guys $iTitle contains user-input. And a sample of testcase.sh as follows:
#! /bin/bash
menu=""
until [ "$menu" = "f" ]; do
echo " a.) Update title"
echo " b.) Update author"
echo " c.) Update price"
echo " d.) Update quantity available"
echo " e.) Update quantity sold"
echo " f.) Back to main menu"
echo " Make selection"
read menu
case $menu in
a)
echo "a" ;;
b)
echo "b" ;;
c)
echo "c" ;;
d)
echo "d" ;;
e)
echo "e" ;;
f)
break ;;
*) ;;
esac
done
I realised my question isn't clear. I've got a user input $iTitle the first code excerpt checks lookup.txt for the same $vTitle. When successful I want the program to run the testcase.sh. Currently it does run, but testcase.sh runs recursively.
testcase.shlook like?testcase.sh(or small example that simulates the problem). If it's code that uses the shell'sselectkeyword, you can try sourcing the file instead,. ./testcase.sh, but if it has a shebang header, you may need to remove that. Lots of other stuff comes to mind. Lets see what's in./testcase.shfirst ;-) . good luck.whilecondition always being true means the same block is exectued over and over again, but with building up a "stack" of calls and doesn't keep consuming more and more computer resources; just your time ;-). Good luck.