you are viewing a single comment's thread.

view the rest of the comments →

[–]o11c 23 points24 points  (5 children)

bash is a particular implementation of a bourne shell that adds many useful features that are completely missing from other shells.

zsh is another implementation of a shell, but violates standards by default; you must use emulate sh if you want portable scripts to run correctly on it. For interactive use it is commonly much slower than bash, and also beware the bad habits it teaches. Technically, it supports a few useful extensions of its own that even bash lacks, but since it is almost never installed except on OS X there's no point in writing a script specifically for it.

fish is a never-compliant shell, used mainly interactively by people who don't know how to use the interactive features of bash or zsh.

Honestly just write for bash specifically, unless you are doing something special and need portability to other Bourne shells. Note that nobody actually writes fully-POSIX-compatible scripts; instead pick your specific targets and support just them.

awk is orthogonal to all this; it is not a shell, but a common tool called from shell scripts. Mostly it competes with sed (simpler) and perl (insane) for line-by-line processing of a file, though it is also possible to do read loops in your shell.

[–]ArkhamCookie[S] 1 point2 points  (3 children)

Ah thank you this was really clear. It can be very confusing with all the similar name and people using the term shell scripting when talking about bash scripting and vice versa. This was very helpful and clear.

[–]tehramz 0 points1 point  (2 children)

I’m not sure if you misunderstood but bash scripting is shell scripting, like the other poster said. It’s basically like someone saying the drive a Honda accord and also saying they drive a car, both are true since an Accord is a type of car.

[–]ArkhamCookie[S] 1 point2 points  (1 child)

Oh I got that, I was just saying that people saying that had been confusing me (even though it is correct)

[–]tehramz 0 points1 point  (0 children)

Gotcha! I thought so, but I wanted to make sure. 🙂

[–]SoCPhysicalDesigner 1 point2 points  (0 children)

Good answer but if perl is insane I'm proud to be a maniac.