Hi,
Could you please tell what is the meaning of -z in while loop condition.
For example,
while [ -z "$name" ]; do
echo "*** Enter the age "
readage
Hi,
Could you please tell what is the meaning of -z in while loop condition.
For example,
while [ -z "$name" ]; do
echo "*** Enter the age "
readage
-z means NULL
while [ -z "$name" ]; do means while value of $name is null.
Things inside brackets are a "test". -z tests "$name" to see if its length is zero.
from "man test":
-z String1
Returns a True exit value if the length of the String1 variable is
0 (zero).
usage : -z <string_name>
meaning: <string_name> is NULL and does exist
it is used in if,while ,....