Reusing argument passed to a bash script

published Jun 01, 2015 11:49   by admin ( last modified Jun 01, 2015 11:49 )

Use $@ . This is magical and will work. Not sure how it is magical, but it is. Put double quotes around it.

 

For passing the arguments to the inner command "$@" -- with the double-quotes, $@ preserves the original word breaks, meaning that the inner command receives exactly the same argument list that your script did.


Read more: Link - linux - Preserve Quotes in bash arguments - Stack Overflow