Skip to content
KerwinKoo edited this page Dec 27, 2015 · 1 revision

shell 判断文件是否存在

if [ ! -f "$STARTED" ];then	# 如果文件不存在,则。。。。

这里的-x 参数判断$myPath是否存在并且是否具有可执行权限

if [ ! -x "$myPath"]; then 
    mkdir "$myPath" 
fi 

这里的-d 参数判断$myPath是否存在

if [ ! -d "$myPath"]; then 
    mkdir "$myPath" 
fi 

[[TOC]]

Clone this wiki locally