How do I print all arguments submitted on a command line from a bash script? - LinuxConfig.org


#1

Question: How do I print all arguments submitted on a command line from a bash script? Answer: 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:


This is a companion discussion topic for the original entry at https://linuxconfig.org/how-do-i-print-all-arguments-submitted-on-a-command-line-from-a-bash-script

#2

B.Max

Awesome, better than what I was looking for.
Thanks :).


#3

Matthew -> B.Max

How can I make printf work with $@ for 2 or more arguments?


#4

B.Max -> Matthew

No idea, I haven’t used that command in Bash.


#5

brustadlasse

maybe something like this? I just warn you that I’m far from good at bash scripting!

if [ $# -gt 1 ]
then
# do your stuff
else
echo Missing args! 2 args is required!
fi