Re: How to protect > and interpret it later on? (w/o using eval)

2011-12-04 Thread Andreas Schwab
Peng Yu writes: > This capability will be useful for debugging bash script. See trap DEBUG and shopt extdebug. Andreas. -- Andreas Schwab, sch...@linux-m68k.org GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 "And now for something completely different."

Re: How to protect > and interpret it later on? (w/o using eval)

2011-12-03 Thread Peng Yu
> THAT will work.  But why are you writing a script to read a shell command > and then execute it?  There is already a program that reads shell commands This capability will be useful for debugging bash script. For example, I have a set of commands in a bash script, each of them output some thing

Re: How to protect > and interpret it later on? (w/o using eval)

2011-12-02 Thread Greg Wooledge
On Fri, Dec 02, 2011 at 08:26:28AM -0600, Peng Yu wrote: > When I call, > > execute.sh ls > /tmp/tmp.txt > > I want it actually to do > > echo "ls > /tmp/tmp.txt" > ls > /tmp/tmp.txt That is impossible. The redirection, being unquoted, is performed by the shell where you are actually typing th

Re: How to protect > and interpret it later on? (w/o using eval)

2011-12-02 Thread Peng Yu
> WHAT are you trying to DO? I think that you might completely miss my point. I try to explain it better. Let me know if this time it makes more sense to you. I want to execute any command as if the 'execute.sh' does not present, except that I want to print the command so that I know want the com

Re: How to protect > and interpret it later on? (w/o using eval)

2011-12-02 Thread Greg Wooledge
; will not work unless eval is used in execute.sh. WHAT are you trying to DO? > > $ ../execute.sh  ls '>' /tmp/tmp.txt ... another pipe to ls! What on earth is this? > > How to make execute protect > and interpret it later on w/o using eval? Your execute.sh script nev

Re: How to protect > and interpret it later on? (w/o using eval)

2011-12-01 Thread Pierre Gaston
===ls > main.sh > > '>' will not work unless eval is used in execute.sh. > > $ ../execute.sh  ls '>' /tmp/tmp.txt > ls > /tmp/tmp.txt > ls: cannot access >: No such file or directory > /tmp/tmp.txt > > How to make execute protect

How to protect > and interpret it later on? (w/o using eval)

2011-12-01 Thread Peng Yu
s '>' /tmp/tmp.txt ls > /tmp/tmp.txt ls: cannot access >: No such file or directory /tmp/tmp.txt How to make execute protect > and interpret it later on w/o using eval? -- Regards, Peng

Re: Using 'eval'

2010-01-26 Thread Marc Herbert
Gerard a écrit : > This is probably a dumb question; however, I have a question > regarding 'eval'. If you know other programming languages, then it helps to consider "eval" as a technique that generates code at run time (and runs it immediately).

Re: Using 'eval'

2010-01-26 Thread Pierre Gaston
On Tue, Jan 26, 2010 at 1:27 PM, Gerard wrote: > This is probably a dumb question; however, I have a question > regarding 'eval'. > eval foo -a -b eval will execute foo -a -b. > eval $(foo -a -b) foo -a -b will run before eval is executed, the output of foo will replace the $( ). ie if foo -a -

Using 'eval'

2010-01-26 Thread Gerard
This is probably a dumb question; however, I have a question regarding 'eval'. I have seen the following statements: eval $(foo -a -b) and eval foo -a -b Are they equal or are there differences between them, other than how they are written out? Does it make any difference which syntax is used

Re: Bad PIPESTATUS when using eval with a pipe stored in a variable

2005-06-30 Thread Philippe Torche
Thanks to all. Per chance I can do my job by simple code change. Philippe. ___ Bug-bash mailing list Bug-bash@gnu.org http://lists.gnu.org/mailman/listinfo/bug-bash

Re: Bad PIPESTATUS when using eval with a pipe stored in a variable

2005-06-30 Thread Paul Jarc
Philippe Torche <[EMAIL PROTECTED]> wrote: > aPipe='|' > eval echo 'titi' $aPipe grep toto | grep titi This is equivalent to: eval "echo titi | grep toto" | grep titi The whole eval counts as one pipeline element, regardless of what's inside it, so the top-level pipeline is only connecting two co

Re: Bad PIPESTATUS when using eval with a pipe stored in a variable

2005-06-30 Thread Chet Ramey
Philippe Torche wrote: > The following script use eval with 3 pipes, 1st time with direct pipe on > the command line, and the 2nd time with a pipe in a variable. > In this second eval, the PIPESTATUS does not content 3 entries, but only 2. > > cat <<'EOF' > eval_pipe.sh > #!/bin/env bash > set -u

Bad PIPESTATUS when using eval with a pipe stored in a variable

2005-06-29 Thread Philippe Torche
The following script use eval with 3 pipes, 1st time with direct pipe on the command line, and the 2nd time with a pipe in a variable. In this second eval, the PIPESTATUS does not content 3 entries, but only 2. cat <<'EOF' > eval_pipe.sh #!/bin/env bash set -u eval echo 'titi' | grep toto | grep