Digital Marketing

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.
name=$1
email=$2

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 "$@"
do
echo $names
done

Comments

Popular posts from this blog

Make online money from the Internet