Tuesday, we linked to an interview with one of the creators of AWK, over at ComputerWorld. From the same series comes an interview with Chat Ramney, maintainer of BASH, the Bourne Again Shell. BASH is the default shell on most UNIX systems, and has been ported to Windows, MS-DOS, the Amiga, and just about everywhere else.Where AWK grew out of a personal need, a solution to a specific problem, BASH grew out of more idealistic goals. Richard Stallman needed replacements for all common UMIX utilities for the GNU operating system, and this included a POSIX-compliant UNIX shell. “When Richard Stallman decided to create a full replacement for the then-encumbered Unix systems, he knew that he would eventually have to have replacements for all of the common utilities, especially the standard shell, and those replacements would have to have acceptable licensing.”
I think Bash’s legacy is as a solid piece of infrastructure, and the shell making millions of Linux, Mac OS X, and Solaris systems work every day.As I recall, it was one of the first couple of programs Linus Torvalds made run on his early Linux kernels.
No week passes without using bash. I use bash very often, although it is mainly for issuing simple commands like cd, rm -r, find -i foo* and vi.
Recently, I read about zsh. I tried it for a few seconds, but I preferred bash’ tab completion better than zsh’s. Still, I should give zsh a better try. Are there some users here who can elaborate on zsh vs bash? This summer, I want to learn my girlfriend to use Linux and a *nix shell, and I have to choose between bash and zsh. Zsh is more modern, but bash is included in the default install of most distros.
That said, I am very happy with bash. It never let me down, it’s easy to use, and more advanced uses are possible too. Thumbs up for bash!
Using the command line and Bash is not required anymore to use computers, even to their fullest. So please, unless she is genuinely interested, don’t make her computer interaction more difficult than it has to be.
Clearly coming from someone who is scared of the command line and has never tried BASH.
Those are two unrelated things.
I’ve written bash scripts a couple of hundred of lines in length, but I don’t wish it upon anybody else.
Only geeks would measure their manliness over how difficult they can make their lives with elitism.
OS X means I only have to use Bash where I *need* to use Bash. Playing with Linux, I’ve found it’s needed for far more than is necessary.
And your problem is that you find it difficult. A lot of us do not and find WIMP GUIs infuriately limiting.
No, I do not find it difficult. I find it difficult to explain it to people who shouldn’t have to know it.
I too disagree. most people do not need to use any terminal, and, there is NO system I know of that the current version will force people to use the terminal.
It is there for people like me who LIKE to use it, rather than blindly click buttons…. Now for my daily rant ™….
Operating systems should not be dumbed down.
I have to take support calls from these dimebars who know nothing about computers, yet go down to PC World and buy whatever they are sold.
I say “whatever they are sold”, because, as well as saying they know nothing about computers, the PC World staff spot this, so sell them the machine that will earn them the biggest commission, telling them it is the best, futureproof etc etc, so they do not believe they have a problem, as
“the PC was the most expensive one in PC World, it cost รยฃ2500 and it is running Vista, the best and newest operating system… so how it cannot be broken”
If people are not prepared to learn, then they should not have parted with their cash.
I think you made some valid points here, allthough they may be off-topic.
First: The topic is titeled “The A-Z of Programming Languages: BASH”. Users don’t care about programming languages, not about their nature, their purposes, their syntax or even their pure existance. So letting the user enter the field of discussion is not useful. You could attach this kind of statement to nearly any topic at OSNews: “The user doesn’t need to know about the OS, he just uses his applications.”
Second: Using bash is about optimizing your work, making it efficient, wasting less time, gaining knowledge, learning. These are things that do not matter to a user.
Third: Users insist on UI applications. That’s completely okay. They do use what a programmer (see first and next idea) gives into their hands. They don’t do enything beside that.
Fourth: Programming is about ceativity. Users don’t create, they use. NB: It’s worth mentioning that they do create things using their applications, but they do not create things releated to these applications. Oh, by the way… Forth is a programming language, too. ๐
Fifth: Using bash may not be required to use a computer, but it may be more useful than using given GUI driven applications if certain reasons can be applied. This is a “can statement”, no force. You can see it the same way as you see tools: It’s not required to use an electric drill to put your pictures on the wall. You can use gaspipe pliers to beat a nail into the wall, or you can use glue. But on some walls, the electric drill is the best solution.
Sixth: Using bash is not about making things “more difficult”; having the last iead still in mind, using anything than bash could be seen as making things “more difficult”, e. g. applying postprocessing rules to a described set of image files under certain conditions (bash: iteration, conditions, call to program “convert” with certain parameters).
Just some ideas.
Having used different programming languages over the years, I may say that I took the chance to learn more about this topic. I gained more and more knowledge about how things work, beginning with algorithmic considerations and ending in how to write a certain piece of code. This puts me into a position where I can offer a solution an “average GUI guy” falls into a state of agony because it’s too difficult for him. And in most cases, the solution is very simple – you just need to be able to see it.
If everybody would think the way you mentioned that nobody would be using computers anymore, because they are “too difficult.” ๐
Edited 2008-05-30 22:06 UTC
It certainly isn’t required, but BASH makes some tasks much easier; especially repetitive tasks.
I think it is funny to see Windows users at work spending large amounts of time manually dinking around with large numbers of files, for instance, and being able to accomplish the same task with a simple for loop using BASH.
Dude, there are better things to do with a girlfriend.
But if a good bashing is what she wants then so be it.
Maybe you should look for a relationship which contains more than sex. It’s fun!
She is studying medical subjects and preparing for doing biomedical research. I feel that persons who want to do research, and have to work with computer tools and lage quantities of data, should at least have some minimal understanding of their tools. Some basic programming, knowing the parts of a computer, and understanding of the “filesystem” and “encoding” concepts are important. Working from a command line gives control and understanding, and sometimes is faster and easier than working with a GUI.
That’s why advanced medical researchers work with S or R (command line programmable statistics packages), and not with SPSS which has a nice GUI but is more suitable for beginners.
Edit: A few days ago, she mailed me a few microscopy photo’s from her professor. It was a powerpoint file. Yes, copied and pasted in powerpoint and mailed that way. That’s what you get by keeping users dumb.
Edited 2008-05-30 11:11 UTC
No, that’s what you get (I got it once): “May I send you a video clip that I found?” – “Yes, of course.” – And what did I get? A “Powerpoint” file which contained two RAR archives that contained a ZIP file that contained an animated GIF file. Yes, it’s possible!
It is true that SPSS has a sophisticated user interface that makes it easy to get started. but the commenter appears to be unaware that it also has powerful programming capabilities.
Besides its long standing traditonal syntax command language, SPSS has plugged in the Python, R, and .NET languages, so it is highly programmable and can use the extensive Python and R mathematical and statistical libraries to supplement its built-in capabilities.
As as BASH user on my Linux systems, I welcome any article drawing peoples attention to this overlooked amazing piece of software.
I use it normally as a command terminal, and occasionally for a few scripts.
BUT.. Calling it a programming language ?
No, it cannot be stretched that far.
It is a script interpreter, so is CSH, ASH and ZSH.
They have idiosyncrasies with some commands being different with each other, but they are not programming languages.
Saying that, Windows users should at least try the power of BASH, maybe then they would get over the feel of “that black box” command line.
So how do you define a programming language? It has variables, functions, flow control and file I/O. With 3rd party libraries (like curses) you can write apps with a UI. It’s Turing complete and all that other good stuff. Now I’ll admit it’s really not a good language for writing longer apps, but that doesn’t make it any less of programming language.
The confusion (as it where) probably arises from ‘bash’ basically refers to two different things. It’s both the name of the the interpreter and the name of language that the interpreter understands.
It’s a Turing complete interpreted language. Bash is no different than most other scripting languages.
I think it’s possible. First, bash has been mentioned to be Turin complete. Furthermore, most command line interpreters are considered to be fully programmable. This means they are able to handle linear processing, piping of information streams, doing operations on files, exit codes and variables, contain iterations, conditions and much more. You’ll find these abilitie in most programming languages, not only in the interpreted ones.
As for the relationship to GUI solutions: As I said, the CLI is fully programmable. The GUI isn’t. In most cases, it’s just a subset of functionalities mapped onto graphical control elements. These require your presence and interaction. Bash doesn’t requier this. You can have it woking some days without being forced to be present at this time, letting the scipt choose from several conditions what to do and what not to do.
And finally, CLIs like bash are a powerful tool that even blind users can use.
Just imagine some task like this: “I have 25000 pictures in different directories; I’d like to have them into one directory, renamed after the directory name and an increasing counter, but files that are present two or more times should only appear once; then create resized previde pictures for all pictures that have names starting with k, m, o up to r or do contain the part “bob”; finally upload the created preview images with FTP to my web server.” I’m sure you can imagine better ideas (read: write a simple script) than “Well, let’s first click on ‘Photoshop’…” ๐
They have similarities to markup or modelling languages, too, but nobody with a serious mind would call HTML a programming language. Oh wait, it’s different in Germany, where a “professional” once told me: “I do program Internet Sites with HTML!” ๐
The scripting language itself can be, at least in my opinion, considered a programming language.
Shhh, don’t wake them! ๐ No, seriously: I think that’s one reason why “Windows” users need to spend that much time inforont of their PC: They need to do everyhing manually. Sure, “Windows” seems to offer some few tools to make some automation of processes, but finally, you end up by clicking on “OK”.
just kidding for APL and ALGOL.
But Ada is for real, and very present in our lives where reliability is paramount.
Bash makes my life easier. Countless small and not-so-small scripts run on my systems daily, doing countless little important tasks. Unattended *NIX systems count on automation, and bash is your friend in this case. A big thanks to the developers and maintainers.
C?
C++?
C#?
COBOL? (Please God no)
That’s all I could think of, but there are plenty more:
http://en.wikipedia.org/wiki/Alphabetical_list_of_programming_langu…
I love Bash. The first time I actually spent money on my Linux hobby was an O’Reilly book on Bash. And they call it programming, thank you very much
Having it on Windows (thank you Cygwin) can be blimmin’ useful too sometimes, though there is a fair bit of lag due to having to load the DLL and the shell first. Still unbelievably handy when batchfiles just don’t offer the kind of sophistication of language you need.
On the subject of the choice for “B”, though: I’d have paid quids to see an article on the Brainf*ck language
ADD COBOL TO LANGUAGE-LIST GIVING VALUE.
๐
default on most unix systems?
did i miss something?
Probably the same thing that I did ..
I don’t see it beign default on “any” UNIX system ..
csh, tcsh, ksh or sh .. but bash?
Except for Linux …
Not even on BSD ..
FreeBSD defaults to tcsh .. OpenBSD goes with ksh, NetBSD defaults to sh and DragonFly goes with sh too if I’m not mistaken …
As far as I knew .. sh was default on most unix systems … maybe I havent used a UNIX in such a long time that things changed a lot =P
Isn’t bash the default on OSX? As far as I know that’s Unix.
The author’s knowledge about Unix should be upgraded.
This is a valid point. On most UNIX systems (commercial UNIXes, BSDs and derivates), the standard shell for stack processing and interaction in maintenance mode is the Bourne shell – sh – while the Bourne Again Shell – bash – can be installed afterwards, as an addition, but is not present on the system by default.
If interoperability is your piece of work, don’t declare
#!/bin/bash
in your scripts, use the standard form
#!/bin/sh
which works on all UNIX systems. And on Linux systems, too, because /bin/sh is just a symlink to /bin/bash in most cases, and bash is able to process sh scripts without problems.
You should not declare bash unless you are using features that are part of bash, but not part of sh. But then, it’s possible that you need to change the declaration so it fits to UNIX systems, for example
#!/usr/local/bin/bash
something else.
Speaking of declaring things, how about using
#/bin/env bash
instead of some absolute path to whatever scripting language you may be using? Using absolute paths to an interpreter really isn’t very good, not for regular scripts.
And to whoever thinks bash is just something you use to ‘traverse the filesystem’, I advise you to seek up a friend with some knowledge in the area and let him show you some neat things that can be done with any shell, really.
Making sure there are no spaces in any filenames, recursively, in a directory.. replacing capital letters recursively.. replacing parts of a filename with something else.. it’s been done for decades using shells, the same cannot be said about GUIs. Whenever you find a task that can/should be repeated, not much beats a command line and a shell.
Good idea, but you included an absolute path, too – /bin/env, which is not portable. For example, FreeBSD’s env is /usr/bin/env. Same problem. ๐
But as I mentioned, /bin/bash is portable, just because (1) it’s the standard shell in UNIX systems, so it’s standard to have it available from this path, and (2) Linux’s bash is symlinked to that standard path. I had experiences with installing scripts on a multiplatform conglomerate of workstations (HP-UX, Solaris, IRIX, BSD, and Linux), and declaring /bin/sh worked everywhere, be the reason the standard path or the symlink.
Shells aren’t only about batch processing or shell scripting, they are able to make your dialog with the machine really efficient. For example, bash has much more capabilities in this field than the more simple sh. Other shells are great means of dialog, too; my favourite one is the csh (tcsh), but zsh can be really handy, too.
You can do with GUIs only what its inventors have thought about. You cannot add new functionality “out of the box”, meaning adding iteration, conditions, information streaming – just as you mentioned correctly.
That’s true. Furthermore, the ability of a shell to be fed by a command script makes it easy to re-use functionalities – something that’s very welcome especially in programming. Don’t do the same thing twice or more.
I like using it (and tcsh in FreeBSD too).
Another interesting shell is “es” (which iirc is public-domain). It has similarities to Plan 9’s “rc” shell.
Es supports functional programming very well. Haven’t used it as much as bash, but it’s quite good.
A couple of es links –
http://en.wikipedia.org/wiki/Es_shell
http://www.webcom.com/~haahr/es/es-usenix-winter93.html
Edited 2008-05-30 23:02 UTC
I use Bash on my Linux systems, but I work with a lot more Solaris servers at work, and they default to ksh. I’ve gotten quite used to ksh, and scripting on it (that’s what I do… I’m the script weenie at work, both Perl and shell).
Still, I prefer Bash.
I wonder if you’ll add in a bit about mksh when it
comes to the letter ‘m’, especially as it is not
that widely known, but has advantages over GNU bash
in certain areas.