Bash has been around since pre-historic times, at least before GNU/Linux’s first release in 1991.
My first personal encounter with Bash was in 1993. This was two years before Microsoft Windows 95 was released and Windows 3.1 was just a bad joke. The Software Development Company I was working for was using SCO Unix running on i486 systems to power Kiosks for displaying, printing and selling sheet music.
My second encounter with Bash was over a decade later was when I first started experimenting with GNU/Linux. I had found a CD in the back of a Linux book with RedHat 7.2 on it– which used an older kernel that had a few missing functions. Like accessing a digital camera, a simple USB Memory Device. So I wrote Bash scripts to mount and access the camera. Then a few more scripts to access a Palm-Pilot like device (My Sony Clie’) and standard USB FlashDrives
Does having a few “encounters” with Bash make me any sort of expert? Answer is no. Honestly, I’m more to solve the problem of the moment type. I’m not a programmer nor do I want to program.
What do I bring to the table when it comes to an article about Bash? My ability to “solve for X” and the research I’ve done to prepare for my next fun project – robotics. To do that I’ll need to use Bash intelligently and to write scrips. Some problems take quite a bit of work to solve, which is where the fun comes in. So I did some Googling and other research.
Okay, enough about me
Is Bash obsolete? Not At all. It may have been around since 1989 but if you want to do something “out of the box”, Bash is probably the sharpest tool in your toolbox. In nearly all GNU/Linux Distros Bash is the default shell. Most Unix Distributions also have Bash as default.
You could use other shells. But why? Bash is the most powerful and flexible. If “necessity is the mother of invention” then since no one has come up with anything better than Bash, I’d guess Bash is as good as it needs to be. Everyone seems happy enough with Bash.
Does your GNU/Linux Distro use Bash?
An easy way to verify your Distro of Linux defaults to Bash is open a terminal Windows. Bash has a unique character prompt, the $. Like this:
The built in man pages of Linux system are an excellent way to jog your memory. East enough to look up the syntax of a command, or a variable’s name, or whatever little detail that you are unsure of. Just type
man bash into your terminal.
Before you go into a frenzied mode of terminal typing, here is a simple list of Bash Key combinations that will make your life easier, plus help prevent Carpal Tunnel Syndrome.
The Tab Command do a filename completion and is especially nice for navigating directories with long names. You can correct typos with the Left and Right Arrow keys and even go to the beginning or end of a line.
Here is the Official Bash Reference Manual, from gnu.org. Here you will find a comprehensive if somewhat hard to follow Manual, especially if you are new to getting your hands dirty “under the hood”.
Research led me to a couple of decent Bash Tutorials, one of which might be of help to you. The first is more beginner orientated and the second more advanced.
Bash has a number of built in commands. Functions that are quite useful in getting your task accomplished. Here is just a taste:
Linux (and Unix) are text based files that can be used to deal with hardware that doesn’t have Linux drivers or to perform custom functions like controlling a peripheral device, like a Robot or motorized telescope mount. Here are three links that I’ve found to be informative.
Bash scripting Tutorial
Steve Parker’s shell scripting guide
Linux Shell Scripting Tutorial
All this sounds complicated. Far less complicated than it could be if a certain philosophy hadn’t been followed, the Unix/Linux Philosophy
- Do one thing and do it well – Write programs that do one thing and do it well. Write programs to work together. Write programs to handle text streams, because that is a universal interface.
- Everything is file – Ease of use and security is offered by treating hardware as a file.
- Small is beautiful.
- Store data and configuration in flat text files – Text file is a universal interface. Easy to create, backup and move to another system.
- Use shell scripts to increase leverage and portability – Use shell script to automate common tasks across various UNIX / Linux installations.
- Chain programs together to complete complex task – Use shell pipes and filters to chain small utilities that perform one task at time.
- Choose portability over efficiency.
In comparison the people at Redmond, Washington on the US of A put all their configuration data into a large database called the registry. Very complex and very hard to understand. They even call them “hives”, kind of appropriate considering needing to edit the registry feels like getting too up close and personal with a wasp nest.
I much prefer Linux’s simplicity
- In this SteamOS era where do the Linux gaming stand?
- Introduction to gnome maps
- How to manage processes with cgroup on Systemd