Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> So, bash is a programming language, right?

No, it's a shell that lets you interact with the OS. All the "clasical" UNIX shells were created with interactive use in mind and optimized for it, but happen to be good enough at batch processing[1] to be conflated with programming languages (mostly these days, like, 40+ years later).

The focus on interactive use is the reason you don't have to

- surround command argument lists with parentheses

- put commas between command arguments

- put semicolons at EOL

- surround string literals with quotes (unless the content interferes with the syntax, like, sigils or IFS chars, and you want to escape it).

- surround variable names in braces (unless you want to use some advanced substitution)

- call commands to manipulate I/O; it's baked in.

And these are just the things that existed 40 years ago. Bash gives you so much more stuff that makes interactive use a bliss, but I'm not going to dump the man page here.

[1]: https://en.wikipedia.org/wiki/Batch_processing



In practice, it's also a programming language :)


Emphasis on "also".

If you optimize a shell feature for general-purpose programming, interactivity will suffer (increased verboseness, usually), and vice versa.

If we try to bring shells closer to the real PLs, instead of just using those PLs when it matters, we'll lose some of things that made shells attractive in the first place.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: