Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

This is the first question in UNIX:

I was started shell script from 2 days before.

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

share|improve this question

closed as not constructive by Gilles, Renan, warl0ck, jasonwryan, manatwork Nov 5 '12 at 8:42

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.If this question can be reworded to fit the rules in the help center, please edit the question.

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? –  donothingsuccessfully Nov 4 '12 at 20:51
add comment

2 Answers 2

up vote 1 down vote accepted

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

share|improve this answer
add comment

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.

share|improve this answer
    
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. –  Emanuel Berg Nov 4 '12 at 22:16
1  
... I think I misread you. That is more or less what you say. –  Emanuel Berg Nov 4 '12 at 22:37
add comment

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