How to Pass Arguments to a Bash Script

Bash arguments are accessed inside a script using the variables $1, $2, $3, and so on. The variable $1 refers to the first argument, $2 to the second argument, and $3 to the third argument.

If you have a variable number of arguments, use the $@ variable, which is an array of all the input parameters. This procedure uses a for loop to iteratively process each one, as illustrated in the following example:
for names in "$@"
echo $names


Popular posts from this blog

Fixed Windows warning: agent returned different signature type ssh-rsa (expected rsa-sha2-512)

How to install/renew SSL Certificate for Glassfish