问候,希望大家身体健康。
我想从跟随
User/ABC/CDE
User/ABC/CDE1
User/ABC/CDE2
User/ABC/CDE3
User/ABC/CDE4
作为
CDE
CDE1
CDE2
CDE3
CDE4
我正在尝试以下代码
list1 = find User/ABC/ -iname "*CDE*"
for lis in list1; do
filename =$(basename $lis)
echo $filename
done
请告诉我这里出了什么问题。谢谢
您的代码有语法错误。请注意空格。要引用变量,需要前缀$
list1=$(find User/ABC/ -iname "*CDE*")
for lis in $list1; do
filename=$(basename $lis);
echo $filename
done