I want to use following in fish shell:

$ export arm='ARCH=arm CROSS_COMPILE=arm-eabi-'
$ make $arm 

This works fine in bash/zsh but not on fish shell.

But if I execute the following in fish shell:

$env tmp=arm make

this works fine.

Can someone please help me with this?

2 Answers 2


You're looking for set -x:

set -x arm 'ARCH=arm CROSS_COMPILE=arm-eabi-'

See the tutorial section on environment variables for more.

  • Though it sounds like it's what the OP is asking, I don't think it is what he wants. Jun 17, 2014 at 9:07

In sh/bash:

export arm='ARCH=arm CROSS_COMPILE=arm-eabi-'
make $arm

Doesn't really make sense. Environment variables are meant as variables passed to make (so a reference to $(arm) in the Makefile for instance expands to its content). Environment variables are scalar, they can contain only one string value. Above you're relying on the split+glob operator of the shell that splits the variable into words passed to make (as arguments).

But $arm is expanded by the shell, so you don't need to export arm to the environment of make because make makes no use of that $arm variable.

Also, on a shell that supports them, it would make more sense to use arrays. In bash /zsh/ksh:

arm=(ARCH=arm CROSS_COMPILE=arm-eabi-)
make "${arm[@]}"

With fish:

set arm ARCH=arm CROSS_COMPILE=arm-eabi-
make $arm

With rc/es/zsh:

arm=(ARCH=arm CROSS_COMPILE=arm-eabi-)
make $arm

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.