array=(abc 123 erg cba)
for file in ${array[@]}; do
echo $file | grep -q 2
if [ $? = 0 ]; then
echo $file
fi
done
shell 用grep查找是否包含指定字符串
最新推荐文章于 2024-03-08 08:29:10 发布
array=(abc 123 erg cba)
for file in ${array[@]}; do
echo $file | grep -q 2
if [ $? = 0 ]; then
echo $file
fi
done