What do $@ and $# mean respectively in Linux shell scripts?

What do $@ and $# mean respectively in Linux shell scripts?

$@: Indicates the content of all script parameters

$#: Represents the number of returned all script parameters.

Example: Write the following shell script and save it as test.sh

#!/bin/sh

echo "number:$#"

echo "argume:$@"

Execute the script:

./test.sh first_arg second_arg

Description: Two parameters are provided to the script, so the result of $# output is 2, and $@ represents the content of the parameter!


Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326263649&siteId=291194637