In my program, I have to check whether a command given as a input by a user exists or not and if it exists, program needs to check if the parameters of that command are correct.
ls( is correct)
- do the watch
and if I do this:
- don't do the watch.
How I can do this? Here is my script:
while true do echo "Insert the command" read comm if [ "$(type -t $comm)" != "" ]; then echo "Insert the parameters of the command "; read par; echo "Insert the time of watch"; read time; if [ $t -le 0 ]; then echo "Value not correct"; else clear; while true do echo "$comm" date echo "" $comm $par sleep $((time)) clear done fi; else echo "Command not found, retry."; echo ""; fi done