赌注
for items in *
do
if [ -f items ]
then
echo $items
fi
done
看看我的目录正如你所看到的,我的目录不是空的,但是,当我运行上面的代码时,它没有打印任何东西..
┌──(istiak㉿kali)-[~/ShellProgramming]
└─$ ./practice.sh
赌注
感谢@muru的评论。
这是答案
for items in *
do
if [ -f "$items" ]
then
printf '%s\n' "$items"
fi
done
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
编辑于
我来说两句