linux中如何利用shell判斷文件或目錄是否存在

linux中如何利用shell判斷文件或目錄是否存在

判斷目錄:

path="/home" #if?[?!?-d?${path}?];then if?[?-d?${path}?];then ????echo?dir?${path}?exist! else ????echo?dir?${path}?not?exist! fi

視頻教程推薦:linux視頻教程

判斷文件:

file="/home/log.txt" if?[?-f?${file}?];then ????echo?file?${file}?exist! else ????echo?file?${file}?not?exist! fi

相關文章教程推薦:linux視頻教程

以上就是

? 版權聲明
THE END
喜歡就支持一下吧
點贊12 分享