I want to add another possibility to the script kplatforms.sh as an optionnal argument. The way it is coded actually is that the last argument is optionnal. So I would like something like an usual Linux command.
Example:
./kplatforms.sh -d distribution -n platform-name [-s platform-state] [-x]
instead of:
./kplatforms.sh distribution platform-name [platform-state]
See also http://drupal.org/node/1323836
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | test.sh_.txt | 619 bytes | mvc |
Comments
Comment #1
j0nathan commentedIncreasing priority because #1488566: htpasswd and htaccess in kplatforms.sh depends on this.
Comment #2
mvcThis is much easier if the user has to write the arguments in the same order, and they can only give the fourth argument when the third one is also present. Then you don't need to write -d or -n. So the command usage would be written:
kplatforms.sh distribution platform-name [platform-state [other argument]]
I have attached an example showing how to do that.
If you really want to allow optional arguments in any order, you will need to use the bash getopts function:
http://wiki.bash-hackers.org/howto/getopts_tutorial
Or use someone else's function to parse these:
https://www.linuxquestions.org/questions/programming-9/bash-script-parsi...
Comment #3
j0nathan commentedThank you very much mvc, I'll start with this example and the links.
Comment #4
j0nathan commentedThis is committed in 5.x-1.x, 6.x-1.x and 7.x-1.x.
kplatforms.sh and README.txt updated.
Documentation updated at http://drupal.org/node/1323836
Comment #6
j0nathan commented