myscript [-a a-arg] [-c c-arg] [-b] [-e] somedirectory
Given that I want my shell script be invoked at the command line using the above parameters - where [these brackets] denote that they are optional - what is the best method to parse them?
Given that I want my shell script be invoked at the command line using the above parameters - where [these brackets] denote that they are optional - what is the best method to parse them?
| |||
|
feedback
|
|
There's a few methods to parse command line arguments. Assuming you're using bash, the least painful way is probably using For example:
[~]$./ssc.sh -ab -c file a 1 b 2 c 4 file | |||||||||||
feedback
|