Skip to content

Instantly share code, notes, and snippets.

@afnanenayet
Created July 9, 2017 22:54
Show Gist options
  • Save afnanenayet/2337239394f8eecdc20cb6b814fac9a1 to your computer and use it in GitHub Desktop.
Save afnanenayet/2337239394f8eecdc20cb6b814fac9a1 to your computer and use it in GitHub Desktop.
An example of how to iterate through command line arguments in shell script
# Iterate through arguments supplied from the command line with
# a loop in Bash script
for arg in "$@"
do
echo "$arg"
done
# Example usage:
# ./iter_args.sh 1 2 3 4 5
# output:
# 1
# 2
# 3
# 4
# 5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment