檢查shell腳本中是否存在目錄在shell腳本中,可以使用什么命令來檢查目錄是否存在?
3 回答

一只斗牛犬
TA貢獻(xiàn)1784條經(jīng)驗 獲得超2個贊
$DIRECTORY
"My M0viez"
if [ -d "$DIRECTORY" ]; then # Will enter here if $DIRECTORY exists, even if it contains spacesfi

月關(guān)寶盒
TA貢獻(xiàn)1772條經(jīng)驗 獲得超5個贊
$ ln -s tmp/ t $ if [ -d t ]; then rmdir t; firmdir: directory "t": Path component not a directory
if [ -d t ]; then if [ -L t ]; then rm t else rmdir t fifi
[
[[
添加回答
舉報
0/150
提交
取消