[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: -ok not totally OK
From: |
James Youngman |
Subject: |
Re: -ok not totally OK |
Date: |
Sun, 9 Nov 2008 12:17:54 +0000 |
On Sat, Nov 8, 2008 at 10:14 PM, <address@hidden> wrote:
> JY> If you would like to propose an illustrative problem for which
> JY> your workaround is the most effective solution, we can probably
> JY> include that in the documentation as an example.
>
> OK, please mention something like:
> -ok in contrast to -exec, has its stdin redirected for various reasons.
> To workaround this, where one would normally use -ok, one should use e.g.,
> -ok true \; -exec ed {} \; #to edit selected files
> -ok true \; -exec mplayer {} \; #to play selected songs
I've updated the bug at https://savannah.gnu.org/bugs/index.php?24561
to include this, but to be honest I am not convinced this particular
case makes a good example, because these constructs probably make more
sense for the real-world problem the user is actually trying to solve:
ed $(find -name '*.c' -ok echo {} \; )
xargs -a <(find -name '*.c') -n1 -p ed
(In the first case ed is passed several files to edit and int he
second, it's only passed 1 at a time, though one only has to change
the argument given to -n in order to change that.
James.