Created
July 9, 2017 22:54
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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