但它显示整个目录路径而不是文件名
PATH=/home/isrctn/Documents/*
for file in $PATH
do
echo $file
done
答案 0 :(得分:1)
查看basename
$ basename /foo/bar
bar
尝试以下方法......
MY_PATH=/home/isrctn/Documents/*
for file in $MY_PATH
do
echo basename $file
rm $file
done