需要帮助才能理解这个脚本我无法弄清楚-z
条件对第一行的意义,然后在if语句中找出-z
和"$1"
的含义
这是脚本:
while [ -z "$USERNAME" ]
do
if [ -z "$1" ]
then
unset ans
unset USER
echo "What is the username you would like to add?"
read USER
echo "Is" $USER " the correct username? [y/n]"
read ans
case "$ans" in
y|Y|yes|Yes|YES)
USERNAME=$USER
;;
答案 0 :(得分:0)
-z
string is null, that is, has zero length
有关bash中Programming Languages Pragmatics的完整信息
有关$1
。
Arguments passed to the script from the command line [1] : $0, $1, $2, $3 . . .
$0 is the name of the script itself, $1 is the first argument