2

To improve compile times, the Arch wiki states,

Users with multi-core/multi-processor systems can specify the number of jobs to run simultaneously. This can be accomplished with the use of nproc to determine the number of available processors, e.g. MAKEFLAGS="-j$(nproc)".

If I set this in Fish shell via set -Ux MAKEFLAGS "-J$(nproc)", then I receive the error:

fish: $(...) is not supported. In fish, please use '(nproc)'. set -Ux MAKEFLAGS "-J$(nproc)" ^ 

I can set this variable in two ways without receiving an error:

  1. set -Ux MAKEFLAGS "-J(nproc)"

  2. set -Ux MAKEFLAGS '-J$(nproc)'

Which of these is the correct method? Or are they both okay?

Thanks

2 Answers 2

3

Neither. In fish, command substitution cannot be quoted.

set arg "-J(nproc)" set -S arg 
$arg: set in global scope, unexported, with 1 elements $arg[1]: |-J(nproc)| 

Use

set -Ux MAKEFLAGS "-J"(nproc) 
0

As of fish 3.4.0, command substitutions can be quoted using the "$()" syntax, so the original command works now.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.