HPR1648: Bash parameter manipulation




Hacker Public Radio show

Summary: 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: http://hackerpublicradio.org/eps/hpr1648_full_notes.html Links Definitions: Unix shell http://en.wikipedia.org/wiki/Unix_shell Bash http://en.wikipedia.org/wiki/Bash_%28Unix_shell%29 GNU Project http://en.wikipedia.org/wiki/GNU_Project References Shell Parameter Expansion http://www.gnu.org/software/bash/manual/html_node/Shell-Parameter-Expansion.html Bash Hackers on parameter expansion http://wiki.bash-hackers.org/syntax/pe Previous HPR shows on the shell or shell scripting: 2008-03-03 HPR0045: Shell Scripting (dosman) http://hackerpublicradio.org/eps.php?id=45 2008-03-12 HPR0052: UCLUG: Newbie Shell Scripting (Dave Yates) http://hackerpublicradio.org/eps.php?id=52 2010-03-24 HPR0531: bash loops (Ken Fallon) http://hackerpublicradio.org/eps.php?id=531 2010-08-11 HPR0562: Introduction to bash scripting (Ken Fallon) http://hackerpublicradio.org/eps.php?id=562 2010-11-17 HPR0598: Bash Scripting: Episode 2 Command Line Basics (Ken Fallon) http://hackerpublicradio.org/eps.php?id=598 2012-05-22 HPR0992: Linux In The Shell 007 - Chmod and Unix Permissions. (Dann) http://hackerpublicradio.org/eps.php?id=992 2012-06-05 HPR1002: Linux In The Shell 008 - free: Understanding Linux Memory Usage (Dann) http://hacke