EN
Bash - capture all arguments passed from command line (regardless of their number)
0
points
In this article, we would like to show you how to capture all arguments passed from command line in Bash.
Practical example
In this example, we use "$@" to capture all arguments passed from command line. Then we iterate through all parameters using for loop and print them using echo command.
#!/bin/bash
for parameter in "$@"
do
echo "$parameter"
done
Run in command line:
./script.sh one two three
Output:
one
two
three