you are viewing a single comment's thread
view the rest of the comments
[–] 8 points 5 months ago* (1 child)

Let me just drop my materials for a talk i've given about basically this topic: https://codeberg.org/flart/you_suck_at_shell_scripting/src/branch/main/you_suck.md

Mainly because: The linked article is all nice and dandy, but it completely ignores the topic of double brackets and why they're nice.

And also, and this is my very strong opinion: if you end up thinking about exception handling (like the mentioned traps) in shell scripts, you should stop immediately and switch to a proper programming language.

Shell scripts are great, i love them. But they have an area they're good for and a lot of areas where they aren't.

  • source
  • hideshow 2 child comments
  • [–] 4 points 5 months ago* (last edited 5 months ago) (1 child)

    Do you need POSIX compability?

    • If not, use bash-isms without shame

    But call it a bash script then! Remember: #!/bin/sh is run by all kinds of shells; consider them POSIX. Bash is #!/bin/bash.

  • source
  • parent
  • hideshow 2 child comments
  • [–] 2 points 5 months ago (1 child)

    Uhm, yes. I noted exactly that as well.

    Also bash is not always at /bin/bash :-)

  • source
  • parent
  • hideshow 2 child comments