I have couple of shell scripts .. I am trying to build a Utility script which would call each script
example ::
1) uni.sh
2) uni2.sh
3)uni3.sh
when i run the Util script it will come as a menu ,, once i press 1 it will call the first shell script and runs it .. Once this script is complete it should comeback to the same screen .. and when the user is pressing some wrong numbers apart from 3 it should prompt Invalid ID and comes to the same screen.. can any one help me on this !!!
[...]
case "$REPLY" in
1) echo "Start script 1 ($choice)." ; /full/path/to/uni1.sh;
[...]
That will echo out your chice to the command line and thenm call your uni1.sh script. It is good practice to add your full path in case the outer script is called from a different location.
call()
{
echo "Input script name:"
read name
flag=0
for i in *
do
if [ $i = $name ]
then
flag=1
fi
done
if [ $flag -ge 1 ]
then
{
sh $name
exit
}
else
{
echo "Wrong file name:"
call
}
fi
}
call
I Tried to run as per your instruction but gave errors
syntax error at line 14 : `)' unexpected
Add /full/path/to/uni1.sh as shown:
[...]
case "$REPLY" in
1) echo "Start script 1 ($choice)." ; /full/path/to/uni1.sh;
[...]
That will echo out your chice to the command line and thenm call your uni1.sh script. It is good practice to add your full path in case the outer script is called from a different location.
[/quote]