News for hackers. Stuff that matters.
Re:A nice, little known C feature: Static array indices in p... by chubot on Tuesday February 19, 2013 @12:52AM (#5242866)
(off topic) I'm sure that was true at some point, but the comment is out of date now. To my surprise, if you download the current bash source code from [1], it actually has a yacc grammar -- see parse.y. It's 6000 lines, but it would be less intelligible without yacc I'm sure.

Honestly, it might be Stockholm syndrome, but I don't find bash hard to parse at all. The only real problem I see is that people get in trouble when they try to nest quoting styles. But there's basically never any reason to do that. User-defined functions basically eliminate this (may not be POSIX compliant, but supported in all shells I know of),

I factor all my shell scripts into 2 to 10 line functions and they are super easy to maintain and are 5-10x shorter than any alternative.

[1] http://tiswww.case.edu/php/chet/bash/bashtop.html

Re:A nice, little known C feature: Static array indices in p... by nitrogen on Tuesday February 19, 2013 @09:09AM (#5244310)
User-defined functions basically eliminate this (may not be POSIX compliant, but supported in all shells I know of),

User-defined functions are part of POSIX, but the function keyword is not. This bit me when I was porting a script from bash to dash (worth the effort on slower devices, as dash is significantly faster loading).

On bash you could do something like this:

  function foo()
  {
      echo "Foo"
  }
In POSIX shell (and, thus, also bash) you do this:

  bar()
  {
      echo "Bar"
  }
Reference: https://wiki.ubuntu.com/DashAsBinSh#function
Re:A nice, little known C feature: Static array indices in p... by caf on Tuesday February 19, 2013 @07:01AM (#5243837)
bash is not the Bourne shell - it's the Bourne Again shell. sh is the Bourne shell.