how I can create this small script?
For example:
~$ script.sh -b my small string... other things -a other string -c any other string ant etc
I want only string, every have a mode.
-b
my small string... other things
-a
other string
-c
any other string ant etc
Anyone know how implements it?
Thanks
Here’s a very simple command-line argument loop. The command-line arguments are
$1,$2, etc., and the number of command-line arguments is$#. Theshiftcommand discards the arguments after we’re done with them.UNIX commands normally expect you to quote multi-word arguments yourself so they show up as single arguments. Usage would look like:
Notice how I’ve quoted the long arguments.
I don’t recommend it, but if you really want to pass in multiple words on the command-line but treat them as single arguments, you’ll need something a little more complicated:
Example usage:
Again, though, this usage is not recommended. It goes against UNIX norms and conventions to concatenate arguments like this.