## hpr1648 :: Bash parameter manipulation

 Bash parameter manipulation
I'm a great fan of using the Linux command line and enjoy writing shell scripts using the Bash shell.

BASH (or more usually Bash or bash) is the name of a Unix shell. The name stands for Bourne Again SHell, which is a play on words. Bash is an extension of the shell originally written by Stephen Bourne in 1978, usually known as SH.
Bash was written as part of the GNU Project which forms part of the Linux Operating System.
A shell is the part of the operating system that interprets commands, more commonly known as the command line.
A knowledge of Bash is very helpful if you would like to be able to use the power of the command line. It is also the way to learn how to build Bash scripts for automating the tasks you need to perform.

In this episode we look at what parameters are in Bash, and how they can be created and manipulated. There are many features in Bash that you can use to do this, but they are not easy to find.
As I was learning my way around Bash it took me a while to find these. Once I had found them I wanted to make a "cheat sheet" I could stick on the wall to remind me how to do things. I am sharing the result of this process with you.
The version of Bash which I used for this episode is 4.3.30(1)-release
The full notes for this episode are to be found here: https://hackerpublicradio.org/eps/hpr1648_full_notes.html
Links

Definitions:

Unix shell https://en.wikipedia.org/wiki/Unix_shell
Bash https://en.wikipedia.org/wiki/Bash_%28Unix_shell%29
GNU Project https://en.wikipedia.org/wiki/GNU_Project

References

Shell Parameter Expansion https://www.gnu.org/software/bash/manual/html_node/Shell-Parameter-Expansion.html
Bash Hackers on parameter expansion https://wiki.bash-hackers.org/syntax/pe

Previous HPR shows on the shell or shell scripting:

2008-03-03 HPR0045: Shell Scripting (dosman) https://hackerpublicradio.org/eps.php?id=45
2008-03-12 HPR0052: UCLUG: Newbie Shell Scripting (Dave Yates) https://hackerpublicradio.org/eps.php?id=52
2010-03-24 HPR0531: bash loops (Ken Fallon) https://hackerpublicradio.org/eps.php?id=531
2010-08-11 HPR0562: Introduction to bash scripting (Ken Fallon) https://hackerpublicradio.org/eps.php?id=562
2010-11-17 HPR0598: Bash Scripting: Episode 2 Command Line Basics (Ken Fallon) https://hackerpublicradio.org/eps.php?id=598
2012-05-22 HPR0992: Linux In The Shell 007 - Chmod and Unix Permissions. (Dann) https://hackerpublicradio.org/eps.php?id=992
2012-06-05 HPR1002: Linux In The Shell 008 - free: Understanding Linux Memory Usage (Dann) https://hackerpublicradio.org/eps.php?id=1002
2013-03-05 HPR1197: What I do with bash scripts (Jon Kulp) https://hackerpublicradio.org/eps.php?id=1197
2013-04-09 HPR1222: LiTS 027: mathematical commands (Dann) https://hackerpublicradio.org/eps.php?id=1222
2013-05-14 HPR1247: Recording Terrestrial Radio with bash scipts and cron jobs (Jon Kulp) https://hackerpublicradio.org/eps.php?id=1247
2013-05-22 HPR1253: Linux in the Shell Ep 30 - vmstat (Dann) https://hackerpublicradio.org/eps.php?id=1253

Resources

Full show notes https://hackerpublicradio.org/eps/hpr1648_full_notes.html
Bash man page extract https://hackerpublicradio.org/eps/hpr1648_summary.pdf
Parameter manipulation "cheat sheet" https://hackerpublicradio.org/eps/hpr1648_diagram.pdf
Various annotated Bash scripts which make up my Magnatune Downloader (described in show hpr1204) https://gitorious.org/magnatune-downloader/magnatune-downloader/source/master:


