Results 1 to 2 of 2
Hi all,
So Ive seen different things when it comes to command arguments, sometimes people use a "-" before or after the parameter letter and sometimes not. Why is this?
...
- 10-20-2011 #1Just Joined!
- Join Date
- Aug 2011
- Posts
- 10
Order of command parameters/arguments
Hi all,
So Ive seen different things when it comes to command arguments, sometimes people use a "-" before or after the parameter letter and sometimes not. Why is this?
Also how do I find out if the order of the parameter matters? Is this in the man pages?
Thanks,
Erin
- 10-20-2011 #2
Depends on the implementation.
For example, a simple bash script takes arguments only in a defined order, also called positional parameter.
Here, three arguments are given to bashscript.sh
#bashscript.sh 1 A file
Inside bashscript.sh, $1 has the value 1, $2 is A, $3 is file.
This works. But a more sophisticated approach is to use getopt
You will notice, that e.g. the order of arguments does not matter anymore.
And yes. In doubt, a man page will tell how a tool shall be used.You must always face the curtain with a bow.


Reply With Quote