[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi] Is this a zsh anomaly?
From: |
Greg Chicares |
Subject: |
[lmi] Is this a zsh anomaly? |
Date: |
Fri, 5 Feb 2016 16:45:59 +0000 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Icedove/38.5.0 |
This (cygwin) bash session behaves as I expect:
$ cat Makefile
all:
echo $(MAKEFLAGS)
$ export coefficiency='--jobs=4 --output-sync=recurse'
$ make -j3
echo -j --jobserver-fds=3,4
-j --jobserver-fds=3,4
But this zsh session behaves differently:
$export coefficiency='--jobs=4 --output-sync=recurse'
$make $coefficiency
make: the '-j' option requires a positive integer argument
If I recall the offending command
$make $coefficiency
, then place the cursor at the end of the line, and press Tab,
it expands to
$make --jobs=4\ --output-sync=recurse
which seems to be the cause of this apparent anomaly: if I
then hit Enter, I get the same 'make' error message.
The space that's getting escaped is just a literal space:
$echo -n $coefficiency |od -t a
0000000 - - j o b s = 4 sp - - o u t p u
0000020 t - s y n c = r e c u r s e
Double-quoting the variable name doesn't help:
$make "$coefficiency" 2>&1 |head -1
make: the '-j' option requires a positive integer argument
I'm using this version of zsh:
$zsh --version
zsh 5.1.1 (i686-pc-cygwin)
and observe the same behavior with this version:
$zsh --version
zsh 4.3.17 (x86_64-unknown-linux-gnu)
I don't find any explanation of this behavior in the manual:
http://zsh.sourceforge.net/Doc/Release/Prompt-Expansion.html
but I suppose that this behavior must be due to prompt expansion
because it works as I expect in a script:
$cat >eraseme.sh <<\EOF
heredoc> make $coefficiency
heredoc> EOF
$./eraseme.sh
echo -j -Orecurse --jobserver-fds=3,4
-j -Orecurse --jobserver-fds=3,4
- [lmi] Is this a zsh anomaly?,
Greg Chicares <=