In the if condition give the $line in the double quotes it will work fine
#!/bin/bash
line="hello welcome "
if [ -z "$line" ] ; then
echo "String null"
fi
In the if condition give the $line in the double quotes it will work fine
#!/bin/bash
line="hello welcome "
if [ -z "$line" ] ; then
echo "String null"
fi