[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [lmi] Is this a zsh anomaly?
From: |
Vadim Zeitlin |
Subject: |
Re: [lmi] Is this a zsh anomaly? |
Date: |
Fri, 5 Feb 2016 17:59:53 +0100 |
On Fri, 5 Feb 2016 16:45:59 +0000 Greg Chicares <address@hidden> wrote:
GC> This (cygwin) bash session behaves as I expect:
GC>
GC> $ cat Makefile
GC>
GC> all:
GC>
GC> echo $(MAKEFLAGS)
GC>
GC>
GC> $ export coefficiency='--jobs=4 --output-sync=recurse'
GC>
GC>
GC> $ make -j3
GC>
GC> echo -j --jobserver-fds=3,4
GC>
GC> -j --jobserver-fds=3,4
GC>
GC>
GC> But this zsh session behaves differently:
GC>
GC> $export coefficiency='--jobs=4 --output-sync=recurse'
GC>
GC> $make $coefficiency
GC>
GC> make: the '-j' option requires a positive integer argument
This is just another example of the main difference between zsh and the
other shells: zsh doesn't split on whitespace by default, i.e.
$coefficiency is always a single word, irrespectively of its contents. This
is not an anomaly in the sense that it's definitely intentional, but it is
indeed different from bash and other shells.
The zsh FAQ explains why this is a good thing better than I could, so I'll
just point you to it for more information:
http://zsh.sourceforge.net/FAQ/zshfaq03.html
The simplest way to work around the problem is to just use
$ make $=coefficiency
to explicitly enable word splitting.
Personally I just do
$ alias make='make -j4 --output-sync=recurse'
which works just as well.
I also wonder if just adding these options to MAKEFLAGS could work, AFAICS
it should but I haven't tested this.
Hope this helps,
VZ