Languages
[Edit]
EN

Bash - capture all arguments passed from command line (regardless of their number)

0 points
Created by:
Theodora-Battle
528

In this article, we would like to show you how to capture all arguments passed from command line in Bash.

Practical example

Edit

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.

Run in command line:

Output:

 

See also

Edit
  1. Bash - how to use command line arguments in script

Alternative titles

  1. Bash - capture all arguments passed from command line (regardless of the quantity)
  2. Bash - propagate all arguments in bash shell script
1
Donate to Dirask
Our content is created by volunteers - like Wikipedia. If you think, the things we do are good, donate us. Thanks!
Join to our subscribers to be up to date with content, news and offers.
Native Advertising
🚀
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

❤️💻 🙂

Join