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: Peng Yu
Subject: Re: [Help-bash] How to protect > and interpret it later on? (w/o using eval)
Date: Sun, 4 Dec 2011 00:42:53 -0600

> 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 to stdout. However, I can not tell the start and end
of each output. I could have a command that does what I expect
execute.sh to do.

cmd1
cmd2
...

I can easily append each command with 'execute.sh', which will not
only tell me the boundary of each output but also help me remember
what command was executed.

execute.sh cmd1
execute.sh cmd2
...

Since what I expect is not possible, the next solution is to use the
eval version which requires to put quote around cmd1, cmd2... But this
is very annoying, when cmd1, cmd2 themselves have the quotation marks,
I have to escape these marks.

So neither solution to execute.sh is ideal, although any of them is
better than the other in certain situations.

-- 
Regards,
Peng



reply via email to

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