判断目录文件是否存在的脚本

#!/bin/bash
#苏苏 su_peng_da

if [ $# ‐eq 0 ] ;then
echo  "未输入任何参数,请输入参数"
echo  "用法:$0 [文件名|目录名]"
fi
if [ ‐f $1 ];then
echo "该文件,存在"
ls -l $1
else
echo  "没有该文件"
fi
if [ ‐d  $1 ];then
     echo "该目录,存在"
     ls ‐ld  $2
else
     echo "没有该目录"
fi

猜你喜欢

转载自blog.csdn.net/weixin_44774638/article/details/88950578