in reply to At Last, a Useful Definition of "Scripting Language"

I don't think there's any reasonable definition of "Scripting Language" that would include C. If you want to script something on *nix, you use sh, ksh, csh, bash, perl, ruby, etc., not C. IMO, one aspect of a scripting language is that you don't need to wrap your executable code in anything magical, like a main() function. A scripting language should be able to take a single line with a single statement and execute it. A question to you *nix-heads: Does a shell script have to have a #! line at the start, or is this just a nice-to-have to make sure the right shell executes it?
  • Comment on Re: At Last, a Useful Definition of "Scripting Language"

Replies are listed 'Best First'.
Re^2: At Last, a Useful Definition of "Scripting Language"
by hardburn (Abbot) on Oct 29, 2004 at 13:20 UTC

    If C is your "get stuff done" language, why not say it's your scripting language?

    Does a shell script have to have a #! line at the start, or is this just a nice-to-have to make sure the right shell executes it?

    The shebang is there so you can say:

    $ ./script.sh

    Instead of:

    $ bash script.sh

    The shebang also makes it possible for other programs to execute the script without knowing what language the program is written in. For instance, Apache/mod_cgi just needs to fork() and exec() on anything specified as a CGI. No need to check the file extention or somesuch to line it up with a specific interpreter.

    It is perfectly possible to leave the shebang out. You just have know what interpreter to use.

    "There is no shame in being self-taught, only in not trying to learn in the first place." -- Atrus, Myst: The Book of D'ni.

      C is a generic programming language, with features deliberately left out because they can't be provided on all platforms (e.g. graphics). To me, a scripting language is an embedded language that controls the operation of that which it is embedded into. Hence, shell script is a language embedded into the shell. JavaScript is a language built into web browsers and web servers to provide programmatic access to their features.

      Perl is somewhat unusual, as it can be embedded into other applicatons, is designed to replace the existing scripting language that the shells provide, and also is a stand-alone language with wider capabilities.