* Holger Rauch ([EMAIL PROTECTED]) [020925 01:07]: > > [...] > > processing the list, i.e. with xargs? It's hard to make suggestions > > without seeing what you're trying to do... > > You're right ;-) What I'm doing is > > FILES=`$LS -lt1 $BACKUP_DIR/arc/*.arc | $TAIL -$NUM_OF_FILES` > for i in $FILES; do > $RM -f $i > done
As others have pointed out, the * expansion is causing the "line too long" problem. Also, ls -l gives you more than just filenames: you get permissions strings, refcounts, owner, group, size, date as well. AFAIK, -l always lists in a single column, so -1 doesn't matter, either. here's another way of doing this, though: instead getting the whole list, sorting it and chopping off all but the end, try this: /usr/bin/find $BACKUP_DIR/arc -type f -maxdepth 1 -name \*.arc \ -mtime +30 -exec rm \{\} \; (that's one long line; note the \-escaped newline). Anyway, my point is that find may be able to help you achieve what you want. My example isn't exactly the same as yours: mine removes files older than 30 days, yours removes the 10 oldest files. But anyway, it's something you might want to look into. good times, Vineet -- http://www.doorstop.net/ -- "Those who desire to give up freedom in order to gain security will not have, nor do they deserve, either one." --President Thomas Jefferson.
msg03569/pgp00000.pgp
Description: PGP signature