bug-bash
[Top][All Lists]
Advanced

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

Re: eval a=b\ c


From: Eduardo A . Bustamante López
Subject: Re: eval a=b\ c
Date: Wed, 27 May 2015 23:55:47 -0500
User-agent: Mutt/1.5.23 (2014-03-12)

On Wed, May 27, 2015 at 12:59:53AM -0700, Dave Yost wrote:
> OK, I can make it to work in bash if I say
>   echodo a=b\\ c
> but then zsh tries to execute c. Can’t win.
> 
> The problem is: how do I write this function so that it can be invoked 
> identically in zsh and bash with identical results of setting a variable to a 
> value with a space in it?

dualbus@hp ~ % for sh in bash zsh; do "$sh" -c 'echodo(){ echo "$*"; eval "$@"; 
}; echodo a=b\\ c; echo "$a"'; done
a=b\ c
b c
a=b\ c
b c

-- 
Eduardo Bustamante
https://dualbus.me/



reply via email to

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