1

I have updated my bash to bash version 4.4.0 on mac osx. However, as explained in this question, I cannot update the bash version under bin/bash but just install a parallel shell under /usr/local/bin/bash

how can I point knitr to this shell? engine.path seems to get ignored:

```{r, engine='bash', engine.path='/usr/local/bin/bash'}
which bash
```

gives

/bin/bash

update

@ Kevin: yes you are right, echo $BASH gives /usr/local/bin/bash

BUT:

from knitr

```{bash, engine.path='/usr/local/bin/bash'}
which bash
echo $BASH
bash --version
```

gives

/bin/bash

/usr/local/bin/bash

GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin15) Copyright (C) 2007 Free Software Foundation, Inc.

while the same from the command line gives

enter image description here

edit 2

after re-reading the answer of @Kevin, this works

```{r, engine = "bash", engine.path = "/usr/local/bin/bash"}
export PATH="/usr/local/bin:$PATH"

bash --version
```

GNU bash, version 4.4.0(1)-release (x86_64-apple-darwin15.6.0)

Community
  • 1
  • 1
Latrunculia
  • 696
  • 1
  • 7
  • 15

1 Answers1

1

What does echo $BASH print? It's possible that your PATH has /usr/bin before /usr/local/bin, or even /usr/local/bin is not on the PATH.

For example, I see:

enter image description here

indicating that engine.path is indeed being respected.

Kevin Ushey
  • 20,530
  • 5
  • 56
  • 88
  • If I give an uncomplete path, I get an error message which reads ```/bin/sh: /usr/local/bin/: is a directory```. Could it be that knitr used some version of ```#!bin/sh``` which calls sh, not bash? And that sh is a symlink to the system bash as suggested in this Question: http://stackoverflow.com/questions/5725296/difference-between-sh-and-bash? However under el Capitan it is not longer (easily) possible to change links in 'rootless' mode (http://stackoverflow.com/questions/32659348/operation-not-permitted-when-on-root-el-capitan-rootless-disabled) – Latrunculia Oct 27 '16 at 09:14