使用符合条件测试

5年以前  |  阅读数:468 次  |  编程语言:Shell 
#!/bin/bash
#testing compound comparisons

if [ -d $HOME ] && [ -w $HOME/testing ]
then
    echo "The file exists and you can write to it"
else
    echo "I cannot write to it"
fi

Copyright© 2013-2020

All Rights Reserved 京ICP备2023019179号-8