Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm running git-bash on windows. I feel the issue I'm facing is more of a NIX geared question than windows. I have a shell script:


build="gulp build"

cd "${myProject}"

When I run this script I get error

gulp build: command not found

When I run "gulp build" directly in the shell, running these same commands by hand then everything works. I tried executing the script via:

. build.sh and just build.sh

Same error either way. How can I run a script that can access gulp/npm? Why does this fail even when I am sourcing the script?

share|improve this question
try just ${build}? – Sergei Kurenkov Mar 18 at 13:38
up vote 11 down vote accepted

Quoting "${build}" prevents word splitting, so it has the same effect here as writing "gulp build" (with quotes), which would search for an executable called gulp build with a space inside the name; and not as writing gulp build, which executes gulp with a build argument.

Concluding, the last line of your script should be:

share|improve this answer

Do not quote "${build}". As it expects in such a case gulp build command (with a space inside) and reports rightfully such command does not exist.

Execute simply by ${build}. Then shell will treat it as a command and arguments.

build="gulp build"

cd "${myProject}"
share|improve this answer
That solved it. Can you link me/provide more detail on when to use quotes? I'm finding it to be a difficult decision. – P.Brian.Mackey Mar 18 at 13:43
I just added more info in the answer, but the general rule is it will treat the quoted string as one piece. If an argument requires a space inside, then you should quote. – techraf Mar 18 at 13:45

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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