help-bash
[Top][All Lists]
Advanced

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

Re: [Help-bash] eval backgrounds with & in variable string


From: Jesse Molina
Subject: Re: [Help-bash] eval backgrounds with & in variable string
Date: Fri, 14 Mar 2014 16:06:03 -0700
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:27.0) Gecko/20100101 Firefox/27.0 SeaMonkey/2.24


Ahha.  Thanks for making me realize how bone-headed that was.

Ultimately my problem was that I had a common variable with a URL in it, which I need to call many times with minor substitution of an ID inside of it.

eval does what it does.  I need to escape those characters.



On 3/14/14, 12:46, Greg Wooledge wrote:
On Fri, Mar 14, 2014 at 12:29:28PM -0700, Jesse Molina wrote:
address@hidden>eval echo 'one&uno&ichi'
[3] 14201
[4] 14202
one
-bash: uno: command not found
-bash: ichi: command not found
Okay, that's definitely not what I wanted.  Eval seems to have evaluated
my "&" characters into being a split and then tries to background those
commands.
Yes.  As expected.  Your command is identical to:

   echo one&uno&ichi

Can I "set" something to make this work, or am I going to have to escape
these on input?
To make what work?  What's the goal?  If you just want to echo that
string, remove the eval and keep the quotes.

While on the subject of eval, does anyone else have fun examples, known
pitfalls, and other interesting things?
http://mywiki.wooledge.org/BashFAQ/048 has some discussion, but is
somewhat light on examples.




reply via email to

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