Re: rm - Arguments too long

From: K Stahl (ktsahl_at_yahoo.com)
Date: 04/26/03

  • Next message: Urs Thuermann: "Why does renaming a directory change its mtime?"
    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`;


  • Next message: Urs Thuermann: "Why does renaming a directory change its mtime?"

    Relevant Pages

    • Re: rm - Arguments too long
      ... K Stahl wrote: ... > Jan Reilink wrote: ... > What happens if there is an embedded space in a file name? ... (no Unix user/admin, but Debian GNU/Linux, even I am OT in this group:) ...
      (comp.unix.solaris)
    • Re: rm - Arguments too long
      ... K Stahl wrote: ... > Jan Reilink wrote: ... > What happens if there is an embedded space in a file name? ... (no Unix user/admin, but Debian GNU/Linux, even I am OT in this group:) ...
      (comp.unix.misc)
    • Re: rm - Arguments too long
      ... K Stahl wrote: ... > Jan Reilink wrote: ... > What happens if there is an embedded space in a file name? ... (no Unix user/admin, but Debian GNU/Linux, even I am OT in this group:) ...
      (comp.unix.admin)
    • Re: rm - Arguments too long
      ... In comp.unix.admin K Stahl wrote: ... > Jan Reilink wrote: ... Real answer: smack whoever did that. ... Dave Hinz ...
      (comp.unix.solaris)
    • Re: rm - Arguments too long
      ... In comp.unix.admin K Stahl wrote: ... > Jan Reilink wrote: ... Real answer: smack whoever did that. ... Dave Hinz ...
      (comp.unix.misc)