help-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-bash] How to protect > and interpret it later on? (w/o using e


From: Pierre Gaston
Subject: Re: [Help-bash] How to protect > and interpret it later on? (w/o using eval)
Date: Sat, 3 Dec 2011 08:47:39 +0200

On Fri, Dec 2, 2011 at 4:26 PM, Peng Yu <address@hidden> wrote:
>> WHAT are you trying to DO?
>
> When I call,
>
> execute.sh ls > /tmp/tmp.txt
>
> I want it actually to do
>
> echo "ls > /tmp/tmp.txt"
> ls > /tmp/tmp.txt
>
I don't think there is a portable way to do that. on linux you could
perhaps do things like
echo "$@"  "> $(readlink -f /proc/$$/fd/1)" > /dev/tty

> Note that there could be other symbols that bash normal process, such as 
> '2>&1'.
> I'm looking for a general solution, Pierre's answer is not as general as I 
> want.

You can use the previous trick for 2 also, but I don't think there is
a way to know that
2 was made a duplicate of 1.

> BTW, where is the help-bash mailing list mentioned (at least not on
> bash home page)? I have never seen it before.

No worry, it was announced on the bug-bash list a couple of days ago,
and thus it is little known,
that's why I told you about it.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]