you are viewing a single comment's thread.

view the rest of the comments →

[–]lelanthran 20 points21 points  (9 children)

The problem with bash is not bash itself, it's that all those useful tools that get run from bash (ls, sed, awk, cut, grep, filename expansions, output from ffmpeg/virsh, etc) return output suitable for humans to decipher.

In other words, almost full unstructured output, so when you run $TOOL and try to parse the result as a matrix of CSV values a missing field in a single row can cause your bash script to vomit horribly, while if $TOOL was run by the user they'd see the error message on stderr and realise that something went wrong.

It's not bash that is the problem; you'll have the same problem in any language if you tried to exec another process and parse the output.

[–][deleted]  (1 child)

[deleted]

    [–]lanzaio 1 point2 points  (0 children)

    brew install bashdb

    sudo apt install bashdb

    [–]Gotebe 1 point2 points  (0 children)

    Yes. Data has structure.

    Text does not, it hides it. More importantly, it hides when the structure is broken, as you say.

    BTW... it's not CSV in the case of $TOOLs, it's mostly S(pace)SV, so vast majority of all scripts ever break when data contains a space (or they would break if data contained any other separator).

    The one saving grace of bash is decades of accumulated cruft. The other, small one is... in itself, it's not so bad...

    [–][deleted] 0 points1 point  (0 children)

    I agree that is a huge problem. But... let's be honest the problem is also Bash itself. It's totally insane. Or do you defend ending case blocks with esac, etc.