Link Search Menu Expand Document

Empty

#! /bin/bash
read -p "type something: " str
if [ -z $str ]; then 
    echo "you didn't type anything"
    #-z will pick up empty string or the string comes with space, using "$str" will ignore space, see below 2nd example
else 
    echo "$str"
fi

echo "Ignore space in between strings "
if [ -z "$str" ]; then 
    echo "you didn't type anything" 
else 
    echo "$str"
fi