Skip to content
Prev 327602 / 398502 Next

Declare BASH Array Using R System Function

On 29/07/2013 08:49, peter dalgaard wrote:
See below: the shell should always be 'sh'.
On recent OS X /bin/sh is *a variant of* bash.  E.g. shopt xpg_echo is 
different if it gets invoked as sh or bash.  Where sh is a link to bash 
the behaviour is usually different depending on how it is invoked.

There are quite a lot of systems for which /bin/sh is not based on 
either bash or Bourne sh.  As I understand it, Debian/Ubuntu nowadays 
use dash by default, and some other Linuxen use ash.  zsh is also seen 
as a system shell.  And in many cases this is configurable

Note too that there is quite a lot of flexibility in how bash is configured.
From ?system

      ?command? is parsed as a command plus arguments separated by
      spaces.  So if the path to the command (or an argument) contains
      spaces, it must be quoted e.g. by ?shQuote?.  Unix-alikes pass the
      command line to a shell (normally ?/bin/sh?, and POSIX requires
      that shell), so ?command? can be anything the shell regards as
      executable, including shell scripts, and it can contain multiple
      commands separated by ?;?.

So you do not have a choice of shell, and the command-line you pass 
needs to invoke a different shell if that is what you want.


But apart from knowing that R's system calls the system(1) OS call (on a 
Unix-alike) there is nothing relevant to R-help here.