参考了一个博主,链接如下:
https://blog.youkuaiyun.com/ai2000ai/article/details/82353591
判断一个文件是文件还是目录时写了一个脚本
#!/bin/sh
for i in *
do
if[-f $i];then
echo “$i is a file”
else
echo “$i is a directory”
fi
done
老是出错
原因: 条件语句 [ ]符号的两边都要留空格
shell脚本 if 语句运行时syntax error near unexpected token `then'
最新推荐文章于 2024-09-20 21:48:23 发布