"/home/shell/DELETE-ME-*"
,包含shell目录中以DELETE-ME开头的所有文件。
以同样的方式,希望排除所有以DELETE-ME开头的文件-尝试了^[DELETE-ME-]
、^[DELETE-ME-*]
,但没有成功。
如何使用grep -v
:
printf "%sn" /home/shell/* | grep -v '/DELETE-ME-'
OR使用find:
find /home/shell -maxdepth 1 -type f ! -name "DELETE-ME-*"
看起来像是extglob
的作业
shopt -s extglob
echo !(DELETE-ME-*) # change echo to your actual command...
shopt -u extglob