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: Greg Wooledge
Subject: Re: [Help-bash] eval backgrounds with & in variable string
Date: Fri, 14 Mar 2014 15:46:31 -0400
User-agent: Mutt/1.4.2.3i

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]