开发者

Selecting multiple file extensions, when some don't exist

开发者 https://www.devze.com 2023-04-01 04:18 出处:网络
I want to select all files with extension f, F and F90. Currently I am trying something like echo *.f *.F *.f90

I want to select all files with extension f, F and F90. Currently I am trying something like

echo *.f *.F *.f90

However, if there are no .f files in the directory (and there is always one of the three) I get left with the *.f, i.e it echos

*.f file1.F file2.f90

开发者_如何学运维Which, if I want to delete them will always complain as *.f doesn't exist.


shopt -s nullglob will fix this in Bash, but is not portable.

0

精彩评论

暂无评论...
验证码 换一张
取 消