by lisper · 5y ago · 0 comments
rm $(ls | grep foo)
will not work if you have file names that contain spaces.
Shell programming is planted thick with landmines like this.
> Besides the extra ls, the suggestion is bad because it relies on shell's word splitting. This is due to the unquoted $(). It's better to rely on the splitting algorithms in xargs, because they're simpler and more powerful.