
文件夹笑誉不存在则创建
文件存在则删除
判断文件夹是否存在
判断文件是否存在
文件比较符
如果身边就有电脑,可以跟着上文一起 *** 作,这样可以更好的理解喔
本文章基碰桐段于Lenovo品牌、Windows10系统撰写的。
//是目录不含洞是文件夹#! /bin/bash
# filename:FileType.sh
read -p "Please input the filename :" filename
fpath=$filename
if [ -d $fpath ]
then
echo "谈渗枯$fpath is a direstory."
elif [ -e $fpath ]
then
echo "喊宴$fpath is a file."
else
echo "$fpath is NOT a file or direstory."
fi
#!/bin/bashif [ 岁启大-d $1 ]
then
echo "$1 is a directory."
exit
elif [ -f $1 ]
then
echo -n "$1 is a file, "
if 乎竖[ -L $1 ]
then
echo "and it is also a symbolic link."
A=`ls -L $1`
if [ -e $A 旁梁]
then
echo "Symbolic link exist."
else
echo "Symbolic link not exist."
fi
exit
else
echo "but it is not a symbolic link."
exit
fi
fi
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)