I'm writing a shell script that can take zero to 2 user arguments.
I have an if statement to check to see if any arguments were entered and then I have a case to enter the arguments into the correct variables. This all works great.
Now, I want to add checking to see if someone adds the argument without a parameter, and then return an appropriate message.
For example, this is the script usage:
psmonitor [-t tseconds] [-n count]
I want checking to so that if someone enters:
it will return a message that the "tseconds" parameter was missing and then display the usage.
Conversely, if someone enters:
I want to return a message saying the count parameter is missing.
I tried adding an "if" statement into the case, but it seems that if it sees that the option/argument isn't complete, then it just goes to the default option.
Any thoughts on how I can make this work?