Judging variables
Read-p "Input a word:" Word
If [!-n "$word"] ; then
echo "You had not input a word!"
Else
echo "The word you are input is $word"
Fi
Judging input parameters
#!/bin/bash
if [!-n "$"]; then
echo "You had not input a word!"
Else
echo "The word you are input is $"
Fi
The following is not verified, transferred from http://blog.csdn.net/lllxy/article/details/3255554
2. Judging directly by variables
The results are as follows: Is NULL
#!/bin/sh
para1=
if
[
!
$para 1
];
Then
Echo
"Is NULL"
Else
Echo
"Not NULL"
Fi
3. Use test to determine
is that DMin is not set!
#!/bin/sh
dmin=
if
Test
-Z
"$dmin"
Then
Echo
"DMin is not set!"
Else
Echo
"DMin is set!"
Fi
4. Use "" to determine the
-
#!/BIN/SH 
-
dmin=
-
if
[
"$ DMin "
=
]
-
Then
-
echo
"dmin is not set!"
-
else
-
echo
"dmin is set !"
-
Fi
Shell determines whether the input variable or parameter is empty