Re: eval a=b\ c

2015-05-27 Thread Eduardo A . Bustamante López
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

Re: eval a=b\ c

2015-05-27 Thread Dave Yost
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? > On 2015-05-26,

Re: eval a=b\ c

2015-05-26 Thread Greg Wooledge
On Mon, May 25, 2015 at 12:33:53PM -0700, d...@yost.com wrote: > # Echo the arguments, then execute them as a command. > I can't find a way to implement echodo in bash. set -x your code set +x

Re: eval a=b\ c

2015-05-26 Thread Andreas Schwab
d...@yost.com writes: > eval$@ You are expanding a shell parameter unquoted. Never do that unless you know what you are doing. eval "$@" Andreas. -- Andreas Schwab, SUSE Labs, sch...@suse.de GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7 "And now for s

Re: eval a=b\ c

2015-05-25 Thread Linda Walsh
Dennis Williamson wrote: I'm trying to put a command in a variable, but the complex cases always fail! : http://mywiki.wooledge.org/BashFAQ/050 Eval command and security issues : http://mywiki.wooledge.org/BashFAQ/048 Dunno, but I see nothing on that page about using printf -v "%q" or

Re: eval a=b\ c

2015-05-25 Thread Dennis Williamson
I'm trying to put a command in a variable, but the complex cases always fail! : http://mywiki.wooledge.org/BashFAQ/050 Eval command and security issues : http://mywiki.wooledge.org/BashFAQ/048 On Mon, May 25, 2015 at 2:33 PM, wrote: > Configuration Information [Automatically generated, do not c

Re: eval a=b\ c

2015-05-25 Thread Linda Walsh
d...@yost.com wrote: Configuration Information [Automatically generated, do not change]: Machine: x86_64 OS: linux-gnu Compiler: gcc Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='x86_64' -DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='x86_64-unknown-linux-gnu' -DCONF_VENDOR='unknown' -DLO

Re: eval a=b\ c

2015-05-25 Thread Charles Daffern
On 25/05/15 20:33, d...@yost.com wrote: > if [[ -n $ZSH_VERSION ]] ; then > echo "[ ${(q)@} ]" > eval${(q)@} > else > echo "[ $@ ]" > eval$@ > fi I believe the bash equivalent here would be something along the lines of: quoted=$(printf '%q ' "$@") quoted=${quoted% } e

eval a=b\ c

2015-05-25 Thread dave
Configuration Information [Automatically generated, do not change]: Machine: x86_64 OS: linux-gnu Compiler: gcc Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='x86_64' -DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='x86_64-unknown-linux-gnu' -DCONF_VENDOR='unknown' -DLOCALEDIR='/usr/local/bash/