Linked by Thom Holwerda on Fri 30th May 2008 07:54 UTC, submitted by fairynomo
General Development 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.
Order by: Score:
fast
by evert on Fri 30th May 2008 08:21 UTC
evert
Member since:
2005-07-06

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!

Reply Score: 4

RE: fast
by Bending Unit on Fri 30th May 2008 08:44 UTC in reply to "fast"
Bending Unit Member since:
2005-07-06

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.

Reply Score: 3

RE[2]: fast
by raver31 on Fri 30th May 2008 08:48 UTC in reply to "RE: fast"
raver31 Member since:
2005-07-06

Clearly coming from someone who is scared of the command line and has never tried BASH.

Reply Score: 1

RE[3]: fast
by Kroc on Fri 30th May 2008 08:57 UTC in reply to "RE[2]: fast"
Kroc Member since:
2005-11-10

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.

Reply Score: 8

RE[4]: fast
by rajj on Fri 30th May 2008 17:20 UTC in reply to "RE[3]: fast"
rajj Member since:
2005-07-06

And your problem is that you find it difficult. A lot of us do not and find WIMP GUIs infuriately limiting.

Reply Score: 4

RE[5]: fast
by Kroc on Fri 30th May 2008 18:12 UTC in reply to "RE[4]: fast"
Kroc Member since:
2005-11-10

No, I do not find it difficult. I find it difficult to explain it to people who shouldn't have to know it.

Reply Score: 2

RE[6]: fast
by raver31 on Sat 31st May 2008 08:05 UTC in reply to "RE[5]: fast"
raver31 Member since:
2005-07-06

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 (tm)....


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.

Reply Score: 2

RE[2]: fast
by Doc Pain on Fri 30th May 2008 22:02 UTC in reply to "RE: fast"
Doc Pain Member since:
2006-10-08

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.


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

Reply Score: 4

RE[2]: fast
by Clinton on Sat 31st May 2008 17:31 UTC in reply to "RE: fast"
Clinton Member since:
2005-07-05

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.

Reply Score: 2

RE: fast
by shapeshifter on Fri 30th May 2008 10:26 UTC in reply to "fast"
shapeshifter Member since:
2006-09-19

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!


Dude, there are better things to do with a girlfriend.
But if a good bashing is what she wants then so be it.

Reply Score: 14

RE[2]: fast
by evert on Fri 30th May 2008 11:09 UTC in reply to "RE: fast"
evert Member since:
2005-07-06

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

Reply Score: 5

RE[3]: fast
by Doc Pain on Fri 30th May 2008 18:53 UTC in reply to "RE[2]: fast"
Doc Pain Member since:
2006-10-08

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.


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!

Reply Score: 2

Programming and SPSS
by peckjonk on Sun 1st Jun 2008 01:59 UTC in reply to "RE[2]: fast"
peckjonk Member since:
2008-06-01

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.

Reply Score: 1

Am I missing something ?
by raver31 on Fri 30th May 2008 08:45 UTC
raver31
Member since:
2005-07-06

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.

Reply Score: 2

RE: Am I missing something ?
by dagw on Fri 30th May 2008 09:22 UTC in reply to "Am I missing something ?"
dagw Member since:
2005-07-06

BUT.. Calling it a programming language ?

No, it cannot be stretched that far.

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.

Reply Score: 7

RE: Am I missing something ?
by Vanders on Fri 30th May 2008 09:24 UTC in reply to "Am I missing something ?"
Vanders Member since:
2005-07-06

It's a Turing complete interpreted language. Bash is no different than most other scripting languages.

Reply Score: 5

RE: Am I missing something ?
by Doc Pain on Fri 30th May 2008 19:05 UTC in reply to "Am I missing something ?"
Doc Pain Member since:
2006-10-08

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.


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'..." :-)

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.


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.

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.


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".

Reply Score: 2

APL? ALGOL? Ada?
by hashnet on Fri 30th May 2008 09:36 UTC
hashnet
Member since:
2005-11-15

just kidding for APL and ALGOL.

But Ada is for real, and very present in our lives where reliability is paramount.

Reply Score: 1

Comment by sonic2000gr
by sonic2000gr on Fri 30th May 2008 10:55 UTC
sonic2000gr
Member since:
2007-05-20

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.

Reply Score: 5

What are we having for "C"?
by Havin_it on Fri 30th May 2008 12:26 UTC
Havin_it
Member since:
2006-03-10

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 ;)

Reply Score: 3

RE: What are we having for "C"?
by rcsteiner on Fri 30th May 2008 17:46 UTC in reply to "What are we having for "C"?"
rcsteiner Member since:
2005-07-12

ADD COBOL TO LANGUAGE-LIST GIVING VALUE.

:-)

Reply Score: 2

lulz
by Replaced on Fri 30th May 2008 13:18 UTC
Replaced
Member since:
2007-05-06

default on most unix systems?
did i miss something?

Reply Score: 3

RE: lulz
by gnemmi on Fri 30th May 2008 13:44 UTC in reply to "lulz"
gnemmi Member since:
2006-08-17

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

Reply Score: 3

RE[2]: lulz
by apoclypse on Fri 30th May 2008 19:31 UTC in reply to "RE: lulz"
apoclypse Member since:
2007-02-17

Isn't bash the default on OSX? As far as I know that's Unix.

Reply Score: 2

RE: lulz
by Babi Asu on Fri 30th May 2008 14:49 UTC in reply to "lulz"
Babi Asu Member since:
2006-02-11

The author's knowledge about Unix should be upgraded.

Reply Score: 3

Interoperability
by Doc Pain on Fri 30th May 2008 17:45 UTC in reply to "lulz"
Doc Pain Member since:
2006-10-08

default on most unix systems?
did i miss something?


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.

Reply Score: 3

RE: Interoperability
by reflect on Fri 30th May 2008 21:00 UTC in reply to "Interoperability"
reflect Member since:
2007-07-10

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.

Reply Score: 1

RE[2]: Interoperability
by Doc Pain on Fri 30th May 2008 21:09 UTC in reply to "RE: Interoperability"
Doc Pain Member since:
2006-10-08

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.


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.

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.


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.

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.


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.

Whenever you find a task that can/should be repeated, not much beats a command line and a shell.


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.

Reply Score: 2

Good ol' bash!
by obsidian on Fri 30th May 2008 22:57 UTC
obsidian
Member since:
2007-05-12

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

Reply Score: 1

Bash is good
by DoctorPepper on Fri 30th May 2008 23:42 UTC
DoctorPepper
Member since:
2005-07-12

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.

Reply Score: 2

mksh?
by mirabilos on Mon 2nd Jun 2008 07:38 UTC
mirabilos
Member since:
2008-03-18

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.

Reply Score: 1