Answers for "bash count number of arguments"

1

bash parameter count

# use $#

# say if you are expecting exactly 2 parameters
# -ne is bash's way of saying not equal
if [[ "$#" -ne 2 ]]; then
	echo "this script needs exactly 2 parameters"
    exit 1
 fi
Posted by: Guest on January-26-2021
3

bash count number of arguments

The number of arguments is $#
Posted by: Guest on September-14-2020

Code answers related to "bash count number of arguments"

Code answers related to "Shell/Bash"

Browse Popular Code Answers by Language