Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
58 lines (44 sloc) 784 Bytes

Run bash scripts

# should exist
Sys.which("bash")
##        bash 
## "/bin/bash"
Sys.which("sh")
##        sh 
## "/bin/sh"

Does bash work?

echo hello world
echo 'a b c' | sed 's/ /\|/g'
# number of lines
awk 'END{print NR;}' 027-engine-bash.Rmd
## hello world
## a|b|c
## 23

How about sh?

# run wc on all engine examples
ls | grep engine | head -n8 | xargs wc
##  124  230 1634 023-engine-python.md
##   73  179 1416 023-engine-python.Rmd
##   16   38  161 024-engine-awk.md
##   11   41  252 024-engine-awk.Rmd
##   12   21  127 025-engine-ruby.md
##    7   17  109 025-engine-ruby.Rmd
##   13   37  234 026-engine-haskell.md
##    8   37  267 026-engine-haskell.Rmd
##  264  600 4200 total