I have the code
read input
case "$input" in
"list"* )
blah
;;
"display"* )
blah
;;
"identify"* )
blah
;;
"rules"* )
perl image.pl $input[1]
;;
"quit" )
echo "Goodbye!"
;;
* )
echo -n "Error, invalid command. "
;;
esac
I’m trying to figure out how to pass the value of $input to image.pl without including the string “rules” in the input.
I.e, if a user enters ‘rules -h’ I want to just pass ‘-h’ to image.pl.
Likewise with my other cases, I would like to specificity test if there have been any other arguments passed along in the input, e.g. for ‘quit’ I would like to test if a user said ‘quit x’ and throw a specific error that ‘quit’ does not accept any other “arguments”.
Thanks.
Assuming you are using Bourne shell as the title specify: