Linux shell 脚本的另一个新手。
基本上我有一个文件夹,里面有很多文件。但我只需要获取以 ".log"
下面是我的版本不工作
#!/bin/sh
for i in *;
do
if [ "$i" == "$i".log ]; then
echo $i;
fi
done
有人可以帮我解决这个问题吗?非常感谢!
最佳答案
你有什么理由不能这样做吗?
for fname in *.log
do
echo $fname
done
关于linux - if 文件名(只是名称)比较 shell 脚本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32330144/