Transfered from Linux Config:
How do I print all arguments submitted on a command line from a bash script?
There are couple ways how to print bash arguments from a script. Try some scripts below to name just few.
In this first script example you just print all arguments:
If you intend to do something with your arguments within a script you can try somethign simple as the following script:
Next we have some script which are doing the same as the previous bash script but employ different approach:
for i; do
Let's print all bash arguments using shift:
for i in $*; do
while (( "$#" )); do
Or we can do something obscure like this to print all bash arguments:
# store arguments in a special array
# get number of elements
# echo each element in array
# for loop
for (( i=0;i<$ELEMENTS;i++)); do