Approved by: Sean Holden on
Confluence/External link(s) used:
Scripts ran through FileWave have the option to supply 'Launch Arguments'. These are referenced from the script, but are not included in the body of the script.
Often Admins feel that there is a limit of 9 'Launch Arguments' through FileWave, but the below will demonstrate this is not the case.
The Launch Arguments, known as Positional Parameters, are referenced as follows:
More may be added and each is referenced in turn by its positional place as in the above table.
Certain shell types behave differently. This may particularly show when referencing the 10th or higher supplied argument.
Although two solutions have been supplied, zsh is recommended to stay in line with Apple's policy:
bash and sh
The following example was hoped to print the first 3 positional parameters, followed by the 10th and 11th.
./bash_test.sh var1a var2b var3c var4d var5e var6f var7g var8h var9i var10j var11k var1a var2b var3c var10j var11k
Not all shells act the same. An alternate to the above would be zsh. Taking the above example as a zsh script:
Unlike bash and sh, zsh considers $10 to be the 10th argument, $11 the 11th argument and so on and so forth. Notice zsh may use either format.
Often admins are confused with output results when using 10 or more arguments. Armed with the above knowledge, this should assist structuring scripts.