Re: rm - Arguments too long
From: Jan Reilink (digiover_at_dsinet.org)
Date: 04/26/03
- Previous message: davehinz_at_spamcop.net: "Re: rm - Arguments too long"
- In reply to: K Stahl: "Re: rm - Arguments too long"
- Next in thread: Richard L. Hamilton: "Re: rm - Arguments too long"
- Reply: Richard L. Hamilton: "Re: rm - Arguments too long"
- Reply: K Stahl: "Re: rm - Arguments too long"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Date: Sat, 26 Apr 2003 10:37:08 +0200
[f'up to comp.unix.misc set, this might go way OT]
K Stahl wrote:
> Jan Reilink wrote:
[...]
>>I haven't seen this answer (yet), it might take a while though:
>>$ cd <directory>
>>$ ls -1 | while read line; do (/bin/rm $line); done
>>
>
>
> What happens if there is an embedded space in a file name?
>
I've never thought about this, it has never happend in _my_ situations... ;)
But thanks, it's wise to keep that in mind.
$ touch "embedded space"
$ ls -1 | while read line; do (/bin/rm $line); done
/bin/rm: cannot remove `embedded': No such file or directory
/bin/rm: cannot remove `space': No such file or directory
$ ls -1 | while read line; do (/bin/rm "$line"); done
does work.
> Why not just:
>
> while read Buff;do /bin/rm "$Buff";done<$(ls -1);
$ touch "embedded space"
$ while read Buff;do /bin/rm "$Buff";done<$(ls -1);
bash: $(ls -1): ambiguous redirect
Regards, Jan
(no Unix user/admin, but Debian GNU/Linux, even I am OT in this group :)
-- Dutch Security Information Network http://www.dsinet.org/
- Previous message: davehinz_at_spamcop.net: "Re: rm - Arguments too long"
- In reply to: K Stahl: "Re: rm - Arguments too long"
- Next in thread: Richard L. Hamilton: "Re: rm - Arguments too long"
- Reply: Richard L. Hamilton: "Re: rm - Arguments too long"
- Reply: K Stahl: "Re: rm - Arguments too long"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Relevant Pages
|