Hacker News new | past | comments | ask | show | jobs | submit login

> It seems like such an insane language

I can understand that because I thought that way too before I really learned it.

Bash is a language like any other: it takes reading and practice to get good at it. Also most of the WTFs in Bash actually make decent sense when you consider that whitespace is the delimiter in bash (for example setting a variable is VAR='value' instead of VAR = 'value'. That trips newer people up pretty badly at first).

Most people also abandon good software practices when they write bash for some reason. For example, you'd never write 100 lines of ruby or javascript without declaring functions, yet people do that all the time in bash (they shouldn't). If people followed good practice, I think bash would seem a lot less insane.




I think lack of proper arrays and structured data types is a big issue with bash. Basically everything is a string, with all the issues around escaping and corner cases that that implies


Bash (4 at least) has proper arrays and hash maps, but granted, the syntax is hideous. The arrays are also limited, but hash maps are somewhat sane.

> declare -a ARRAY > declare -A MAP


Yeah very fair. I actually thought I included a line like this: "If you need arrays, hashes, or floating point math then bash is a poor choice" but I must have deleted it (I've been trying to use more brevity when I write).




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

Search: