EN
Bash - omit first argument from command line
3
points
In this article, we would like to show you how to omit first argument from command line in Bash.
Practical example
In this example, we use "${@:2}" to capture all arguments passed from command line starting from the second argument. Then we iterate through all parameters using for loop and print them using echo command.
Example script.sh file:
#!/bin/bash
for argument in "${@:2}"
do
echo "$argument"
done
Run in the command line:
./script.sh one two three
Output:
two
three