paulwong

linux shell 中检查文件夹是否存在

To check if a directory exists in a shell script, you can use the following:
if [ -d "$DIRECTORY" ]; then
  # Control will enter here if $DIRECTORY exists.
fi

Or to check if a directory doesn't exist:
if [ ! -d "$DIRECTORY" ]; then
  # Control will enter here if $DIRECTORY doesn't exist.
fi

posted on 2020-09-25 11:11 paulwong 阅读(371) 评论(0)  编辑  收藏 所属分类: LINUXLINUX-SHELL


只有注册用户登录后才能发表评论。


网站导航: