bash check arguments code example
Example 1: verify parameter one bash
if [ -z "$1" ]
then
echo "No argument supplied"
fi
Example 2: shell script get arguments
$ myscript.sh first_arg second_arg
# myscript.sh
#!/bin/bash
echo $1 # output: first_arg
echo $2 # output: second_arg
Example 3: if argument bash
if [ -z "$1" ]
then
echo "No argument supplied"
fi
if ["$1" ]
then
echo "Argument supplied is: "$1
fi