shell脚本中-n是判断一个变量是否是否有值

#其他参数还有-n,-n是判断一个变量是否是否有值
if [ ! -n “$myVar” ]; then
echo “$myVar is empty”
exit 0

fi 

沃建设#each_day_file_processed_number /home/unicomlabs/*_bak5/log/log_*

        for j55 in `ls /home/unicomlabs/|grep bak5`
        do
        for j5 in `ls  /home/unicomlabs/$j55/log/log_* |grep _${pre_date1}`
        do
        cat $j5|wc -l >> /home/unicomlabs/ip5.txt;
        done

        if [ ! -n “$j5” ]
        then
        echo “0” >> /home/unicomlabs/ip5.txt
        fi
        done

    原文作者:mmbbz
    原文地址: https://blog.csdn.net/mmbbz/article/details/60754481
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞