checking the number of parameters
hi
how to check the number of parameters that user passes to script. when number of them don't match to the desired number, script should be interupted. |
$# stores the actual number of arguments passed to a script. You may check its value against a fixed one, with a simple if-then construct.
|
Quote:
In any case, almost every language stores the args in an array, of which you can easily check the length of. Be sure to subtract 1 from this if you are using a language that also stores the script name. |
Quote:
|
oh my god. thanks for your notice. thats right. i forgot it ;)
i mean Korn shell scripting language. |
All times are GMT -5. The time now is 04:04 AM. |