This is my first question in UNIX:

I started with shell scripts 2 days ago.

But I have a question: is a shell script a special programming language for a specific shell?

  • 2
    Do you mean you wrote a shell script and it executed with no errors, then you tried to execute it in another environment and got an error? If so what was the error message? Nov 4, 2012 at 20:51

2 Answers 2


Bash is a scripting language:

From wikipedia:

A scripting language or script language is a programming language that supports the writing of scripts, programs written for a software environment that automate the execution of tasks which could alternatively be executed one-by-one by a human operator. [...]

The term script is typically reserved for small programs (up to a few thousand lines of code).

Scripts are typically quick and dirty. Say, a bash script to make your life easier. Whereas a 'programming' language is meant to be much more thought out and deliberate.The thing with 'programming' languages is that they are usually faster, and offer more control over low-level things if you want.

'programming' languages are typically used in scenarios where the code will be around for a long time. If you want to write something quickly and then never use it again, 'scripting' languages are what you want.

You can find an interesting article here.

  • Well, scripts are not only things you (= the user) write to automatize things (that's the "tool" side to scripts). Examine your system, there are scripts everywhere: that's the "glue" side to it. Also, while it is true that the expert C/assembler programmer has total control, in most normal settings, it is much better to invoke a standard application that's been around and tested for decades. Point is, C is great, scripts are great, the challenge is when to use what. Nov 4, 2012 at 22:16
  • 1
    ... I think I misread you. That is more or less what you say. Nov 4, 2012 at 22:37

If you know of any command, say, ls, you type it, and then hit return, the shell will know where that program (ls) is, invoke it, and show you the result. This is the "non-script" shell usage.

But, if you order a couple of such commands in a sequence, say A, B, C, D, and then put it (the sequence) in an executable file, you've got a program. The program has a name and location, so it can be referenced, and invoked; it has code, so it can be executed, one command at a time, by the CPU.

(The program is not compiled - like, for example, C source would have been - and this makes it a script. But it is a program nonetheless.)

That is, in some aspect, already at this point you are programming, because you are instructing the computer what to do.

Furthermore, you are, again at a very basic level, also using a programming language, because you can't just type anything (and expect it to work); at the same time, whatever you type you'll get activity from the computer that corresponds exactly to what you wrote.

There are rules how you should say things, and there are rules how the computer will react to those things.

That said, with "programming", you typically associate somewhat more expressive power than just piling commands on top of each other. At the very least, you'd like branching (if ... then ... else), iteration (loops: while, for, etc.), and probably some other things as well. But that's OK as the scripting languages have those things and more.

The shells have different languages, yes, but some may overlap to a great extent because of convention (why change a good way to say something?), or to be compatible with earlier versions (or some standard).

Not the answer you're looking for? Browse other questions tagged or ask your own question.