Setting a bash variable from backtick operator fails

cyg Simple cygsimple@gmail.com
Tue Feb 27 14:46:00 GMT 2018


On 2/27/2018 9:12 AM, 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)
> 

Can anyone else confirm this?  My version just works but I can't update
to a newer version for another couple of days.

$ uname -a
CYGWIN_NT-10.0 eboyd53ent-lt1 2.9.0(0.318/5/3) 2017-09-12 10:18 x86_64
Cygwin


> 
> 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?

Try as a simple test:
$ PATH=/usr/bin test=`echo "x86_64-pc-cygwin" | sed 's/-[^-]*$//'`; echo
$test

Maybe something in your environment is causing it and this would remove
the potential of something not Cygwin in the way.

-- 
cyg Simple

--
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



More information about the Cygwin mailing list