- Code: Select all
for a in `ls -u|tail`;do rm "$a";done
but that doesn't work if there is spaces in the filenames.
for a in `ls -u|tail`;do rm "$a";done
ls -u |tail |while read a; do rm -f "$a"; done
Mayavimmer wrote:
- Code: Select all
ls -u |tail |while read a; do rm -f "$a"; done
Of course, be safe when removing stuff.
Your version does not work because the backticks phrase is inline replaced by the output of its commands, coalescing all newlines and other whitespace to single spaces.
rm *(Oa[1,10])
Users browsing this forum: No registered users and 1 guest