Bash Check If Argument Exists Code Example


Example 1: verify parameter one bash


if [ -z "$1" ]
then
echo "No argument supplied"
fi

Example 2: if argument exists bash


if [ -z "$1" ]
then
echo "No argument supplied"
fi

if ["$1" ]
then
echo "Argument supplied is: "$1
fi

Comments

Popular posts from this blog

Converting A String To Int In Groovy

"Cannot Create Cache Directory /home//.composer/cache/repo/https---packagist.org/, Or Directory Is Not Writable. Proceeding Without Cache"

Android How Can I Convert A String To A Editable