This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Setting a bash variable from backtick operator fails


On 2018-02-27 07:12, Numien wrote:
> While working on diagnosing an issue with autotools, I found Cygwin's
> bash seems to not be able to set a variable from backtick substitution,
> at least on my system (Cygwin x86_64, updated today, on Win10)
> On a Linux system it works as expected:
> $ test=`echo "x86_64-pc-cygwin" | sed 's/-[^-]*$//'`; echo $test
> x86_64-pc
> On a Cygwin system it doesn't:
> $ test=`echo "x86_64-pc-cygwin" | sed 's/-[^-]*$//'`; echo $test
> (no output)

WJFFM:

$ uname -srvmo
CYGWIN_NT-10.0 2.10.0(0.325/5/3) 2018-02-02 15:16 x86_64 Cygwin
$ test=`echo "x86_64-pc-cygwin" | sed 's/-[^-]*$//'`; echo $test
x86_64-pc

> This also happens in scripts (where I originally encountered the
> problem), not just on the command line.
> Directly outputting it (echo `echo "x86_64-pc-cygwin" | sed
> 's/-[^-]*$//'`) works fine, it seems to be specifically related to
> setting a variable.
> Any suggestions?

Incompatible keyboard or console locale, terminal, .inputrc, or shell settings;
shell variable test set with incompatible attributes in profile; AV -
disable/bypass?

$ locale
LANG=en_CA.UTF-8
LC_CTYPE="en_CA.UTF-8"
LC_NUMERIC="en_CA.UTF-8"
LC_TIME="en_CA.UTF-8"
LC_COLLATE="en_CA.UTF-8"
LC_MONETARY="en_CA.UTF-8"
LC_MESSAGES="en_CA.UTF-8"
LC_ALL=en_CA.UTF-8
$ echo $TERM
xterm-256color
$ echo $SHELL
/bin/bash
$ declare -p INPUTRC
-bash: declare: INPUTRC: not found
$ bind -lpsvX
... lots of output
$ set
... lots of output
$ declare -p test
declare -- test="x86_64-pc"

-- 
Take care. Thanks, Brian Inglis, Calgary, Alberta, Canada

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]