# Bash: command not found

**URL:** <https://travis-ci.community/t/bash-command-not-found/5405>\
**Category:** Travis CI Discussions & Feedback\
**Created:** [October 11, 2019, 3:24pm UTC](https://travis-ci.community/t/bash-command-not-found/5405 "2019-10-11T15:24:55Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![mbroadst](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/mbroadst/32/2876_2.png) [@mbroadst](https://travis-ci.community/u/mbroadst)\
**Post date:** [October 11, 2019, 3:24pm UTC](https://travis-ci.community/t/bash-command-not-found/5405/1 "2019-10-11T15:24:55Z")

</div>

I am trying to run a bash script from within a `before_install` hook, and Travis is telling me that bash is not installed. This is quite surprising, can you please advise how we should proceed?

error in action: [https://travis-ci.org/mongodb/node-mongodb-native/jobs/596654744#L272](https://travis-ci.org/mongodb/node-mongodb-native/jobs/596654744#L272)  
travis configuration: [https://github.com/mongodb/node-mongodb-native/blob/test-runner/.travis.yml#L25](https://github.com/mongodb/node-mongodb-native/blob/test-runner/.travis.yml#L25)

---

<div class="post-metadata">

**Author:** ![BanzaiMan](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/banzaiman/32/67_2.png) [@BanzaiMan](https://travis-ci.community/u/BanzaiMan)\
**Post date:** [October 11, 2019, 4:04pm UTC](https://travis-ci.community/t/bash-command-not-found/5405/2 "2019-10-11T16:04:09Z")

</div>

It’s not `bash` that’s not found, but rather, `" bash"` with extra spaces in front.

Try

```
  - TOPOLOGY=${MONGODB_ENVIRONMENT} bash ${DRIVERS_TOOLS}/.evergreen/run-orchestration.sh

```

instead.

---

<div class="post-metadata">

**Author:** ![mbroadst](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/mbroadst/32/2876_2.png) [@mbroadst](https://travis-ci.community/u/mbroadst)\
**Post date:** [October 11, 2019, 4:47pm UTC](https://travis-ci.community/t/bash-command-not-found/5405/3 "2019-10-11T16:47:47Z")

</div>

Hey @BanzaiMan, thanks for the quick response! This gets me further, nice catch on the spaces there. Related question: I have an `after_failure` hook set up to print log files, but it doesn’t seem to run if something fails in the `before*` hooks, is it possible to execute a hook after a failure during the setup phase?

In this particular case I think my issue is that a few of the commands in the setup are not being run (lines 21-22 in the config linked above). I had to wrap the lines in quotes in order to accommodate the complex regular expressions on the line, but they never show up in the logs as being run - it looks like travis just skips them.

---

<div class="post-metadata">

**Author:** ![BanzaiMan](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/banzaiman/32/67_2.png) [@BanzaiMan](https://travis-ci.community/u/BanzaiMan)\
**Post date:** [October 11, 2019, 5:00pm UTC](https://travis-ci.community/t/bash-command-not-found/5405/4 "2019-10-11T17:00:51Z")

</div>

> [@mbroadst](#):
>
> it doesn’t seem to run if something fails in the `before*` hooks, is it possible to execute a hook after a failure during the setup phase?

If you need to do this, you’ll have to devise your own `failing_command || dump_log` logic.

> [@mbroadst](#):
>
> In this particular case I think my issue is that a few of the commands in the setup are not being run (lines 21-22 in the config linked above).

I see them here [Travis CI - Test and Deploy with Confidence](https://travis-ci.org/mongodb/node-mongodb-native/jobs/596690516#L260-L261)  
and I don’t think these commands produce any output in the best of times. You can add something to force it; e.g., `-print` for `find` to print the matching file, or tell `sed` to echo the lines as well as editing files in place. They didn’t cause the job to error, so they exited with status 0.
