Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Bash for loop on command-line arguments

  • $@
If there is no list to go over (there is no "in something" part) then by default it will go over
the values on the command line as if this was written:

for a in "$@"
#!/usr/bin/env bash

# Ynon

for a
do
   echo "Argument $a"
done

# ./examples/for_arguments.sh a bb "c d"