I have been earnestly studying BASH for a while now, but I recently came across something that will be very useful and I thought I’d pass it along.
Famously enough I run Ubuntu (a Debian-based distribution of Linux). This is where I do my scripting in BASH, though I also use BASH on my Mac (native) and Windows (through Cygwin).
I have discovered a package called bash-doc which contains a plethora of BASH example scripts and code chunks.
To install bash-doc you just mark it for installation in Synaptic and Apply that change.
- System —> Administration —> Synaptic Package Manager
- Scroll down to locate bash-doc
- Right-click on bash-doc and select Mark for Installation
- Click the Apply button
- Double-check the package you are installing and click OK
Alternatively you could enter this simple line of code directly into BASH via the terminal: sudo apt-get install bash-doc (your password will be required either way).
Once you have installed this package you will find a host of examples:
/usr/share/doc/bash/examples/
Have fun with that. I know I will.