From 2410586149e1450a5c6f97112f6cefb09f45b639 Mon Sep 17 00:00:00 2001 From: Maximilian Held Date: Thu, 14 Mar 2019 17:30:20 +0100 Subject: [PATCH] add more bash resources --- stack.Rmd | 32 ++++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/stack.Rmd b/stack.Rmd index fa43b69..20d1c5b 100644 --- a/stack.Rmd +++ b/stack.Rmd @@ -280,9 +280,12 @@ You also need to *configure* git on your machine, and wherever else you are usin Install Bash Shell -The bash shell is the standard Unix-style command-line interface (CLI) (as opposed to a point-and-click graphical user interface, or GUI). +A shell is a command-line interface (CLI) to your computer (as opposed to a point-and-click graphical user interface, or GUI). +You may also know this as "the console", or "the terminal". + +There are technically different *kinds* of shells, though the `bash` shell is the most widespread, and is often used interchangeably with *the* shell. + A lot of programs that we'll be using only run at the CLI, so it's important to know how to use it. -It is also often used in scripting (= automating) tasks. On **macOS**, **Linux**: Nothing to install, ships with bash. @@ -315,6 +318,31 @@ However this is strictly optional, will not be supported in class. - [The Unix shell](https://swcarpentry.github.io/shell-novice/02-filedir/index.html) +### Bash {#bash} + +It turns out that `bash`, the default shell on UNIX-type computers is *also* a **scripting language** upon itself. +[Scripting languages](https://en.wikipedia.org/wiki/Scripting_language) are programming languages which facilitate automated execution of tasks, such as, say, running a bunch of updates and then power cycling your computer. + +`bash` isn't necessarily the greatest scripting language; especially for more complicated projects, "proper" scripting languages such as Python, Ruby or R might serve you better. + +But `bash` has the advantage that it is available in (almost all) UNIX-type computing environments, so it's often the easiest way to automate steps. +It looks a bit arcane (because it is), but you don't need much to build powerful scripts that can save you a lot of time. + +This entire topic and the below *additional resources* is recommended for advanced readers. +You won't need this starting out. + + +#### Additional Resources + +- [The Unix Workbench](https://seankross.com/the-unix-workbench/index.html) +- [Writing Shell Scripts - Beginners Guide](https://medium.com/tech-tajawal/writing-shell-scripts-the-beginners-guide-4778e2c4f609) +- [Bash Boilerplate](http://bash3boilerplate.sh) +- [Bash programming by (counter-)example](http://matt.might.net/articles/bash-by-example/) +- [Tips and Tricks for good Bash Scripts](https://codeburst.io/13-tips-tricks-for-writing-shell-scripts-with-awesome-ux-19a525ae05ae) +- [Bash Scripting Best Practices](https://sap1ens.com/blog/2017/07/01/bash-scripting-best-practices/) +- [Writing Readable Bash Scripts](https://mads-hartmann.com/2017/06/16/writing-readable-bash-scripts.html) +- [Google Shell Style Guide](https://google.github.io/styleguide/shell.xml) + ### Package Management {#pkg-mngt}