Re: rm - Arguments too long
From: K Stahl (ktsahl_at_yahoo.com)
Date: 04/26/03
- Previous message: Richard L. Hamilton: "Re: rm - Arguments too long"
- In reply to: Jan Reilink: "Re: rm - Arguments too long"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Date: Sat, 26 Apr 2003 17:53:17 GMT
Jan Reilink wrote:
>
> [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/
Bash would probably only understand it like this:
while read Buff;do /bin/rm "$Buff";done<`ls -1`;
- Previous message: Richard L. Hamilton: "Re: rm - Arguments too long"
- In reply to: Jan Reilink: "Re: rm - Arguments too long"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Relevant Pages
|