[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Gnu-arch-users] Pipes?
From: |
Jan Hudec |
Subject: |
Re: [Gnu-arch-users] Pipes? |
Date: |
Thu, 18 Mar 2004 09:23:46 +0100 |
User-agent: |
Mutt/1.5.5.1+cvs20040105i |
On Wed, Mar 17, 2004 at 16:13:01 -0700, Pierce T.Wetter III wrote:
>
> >For filenames with spaces, this works really well:
> >
> >tla tree-lint -m --unescaped | while read line; do tla delete "$line"
> >; done
> >
> >This delimits arguments by newline instead of spaces which seems to be
> >your problem, or no?
>
> Nope, its more complicated then that. (the above didn't work either)
>
> escaping just got added to tla. However, it seems to be a different
> escaping
> then that used by any of the shells.
>
> So if the shell gets involved at any point, bad things happen. Your
> above example changes the \\ to a \ for instance...
The above example should be fixed by adding -r option to read.
However, it's still incorrect, since it can't read in newline char.
> Same with xargs.
>
> At the end of the day, since tla is doing the escaping, presumably tla
> will know how
> to undo it as well. So if the shell is kept out of the loop, then it
> won't have
> any chance of "mucking it up". There is a similar problem with xargs...
Tla does. Actualy the correct way to write the above should be:
tla tree-lint -m | while read -r line; do line=`tla escape --unescaped $line+`;
tla delete "${line%+}"; done
And even then I am not sure shell won't discard the hard protected space on the
end!
> Since tla already outputs lists of files, and already suppresses the
> annotation of what those files are (i.e. tree-lint and tree-lint -m
> have different outputs), pipes seem like a simple way around the issue.
> The other option would be to use a less unique escaping scheme, but
> that seems like a lot more work.
It's not that much work. It's actualy pretty simple. Just replace it in
one source file in hackerlab.
> Any sort of while loop (and isn't xargs just another case of a while
> loop?) seems more complicated then a pipe anyways.
No, xargs is an external command. The difference is quite significant.
-------------------------------------------------------------------------------
Jan 'Bulb' Hudec
<address@hidden>
signature.asc
Description: Digital signature
- Re: [Gnu-arch-users] Pipes?, (continued)
- Re: [Gnu-arch-users] Pipes?, Pierce T . Wetter III, 2004/03/17
- Re: [Gnu-arch-users] Pipes?, Tom Lord, 2004/03/17
- Re: [Gnu-arch-users] Pipes?, Matthieu Moy, 2004/03/17
- Re: [Gnu-arch-users] Pipes?, mlh, 2004/03/17
- Re: [Gnu-arch-users] Pipes?, Tom Lord, 2004/03/17
- Re: [Gnu-arch-users] Pipes?, mlh, 2004/03/17
- Re: [Gnu-arch-users] Pipes?, Tom Lord, 2004/03/17
- Re: [Gnu-arch-users] Pipes?, Adrien Beau, 2004/03/18
- Re: [Gnu-arch-users] Pipes?, David Snopek, 2004/03/17
- Re: [Gnu-arch-users] Pipes?, Pierce T . Wetter III, 2004/03/17
- Re: [Gnu-arch-users] Pipes?,
Jan Hudec <=