Skip to content

Latest commit

 

History

History
57 lines (44 loc) · 784 Bytes

027-engine-bash.md

File metadata and controls

57 lines (44 loc) · 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
##  111  222 1585 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
##  251  592 4151 total