Hi can someone please help me with an infinite loop that is to take new arguments. Is there a read command that each space as a new argument like the command line does. all seem to set it all to one big argument
I have a script, when called it enters an infinite loop. The first argument will determine a case to call another script, the second argument will then be sent to that script. I then want to loop around again and ask the user for two arguments again in the same line. The first determining the case and using the second...
However I want these to be in the one line as if it was the command line. I believe the read command will set the whole line to a variable while i want to do $1 and $2 again.
I provided a little code to describe my issue, thank you in advance
I basically need a read command that will split into arguments like the command line.
while true :
do
# make decision using case..in..esac
choice = $1
case $choice in
create)
./create.sh $2
;;
add)
./add.sh $2
;;
*)
echo "Error: Invalid option..."
;;
esac
done
read one two.