• Hazzia@discuss.tchncs.de
      link
      fedilink
      arrow-up
      9
      ·
      9 months ago

      I know that there are use cases for [ ] over [[ ]]. There have to be. Why in god’s name would [ ] exist if there wasn’t a reason to use it over [[ ]]? I’m obviously the one in the wrong by only ever using [[ ]], because [ ] would definitely be better in some type of situations that I’m just not seeing clearly. Right???

    • CoderKat@lemm.ee
      link
      fedilink
      English
      arrow-up
      2
      ·
      9 months ago

      Bash is so bad. I literally use it every day and have written many Bash scripts, yet I’m constantly having to search for how to do things in it because syntax is so bizarre and difficult to remember. Need to do a for loop over lines in a file? You can bet I’m googling the syntax for it. I have a general idea for what it looks like and know what to search for, but no way in hell can I write it correctly in the first few tries.

      String manipulation is the absolute worst. Have fun getting to learn the unreadable syntax of most sed and awk programs (the only thing most people have memorized is find and replace). Stuff like “split a string of comma separated ints and add them up” are way harder in Bash than in Python, despite the fact I often need to do stuff like that in Bash. Well, in the terminal anyway. Sometimes I’ll just use Python, but Python’s weakness is executing programs and getting their output, which is nowhere near as convenient as it is in Bash.

      Side note, isn’t it weird that for a language where flags like --foo bar are so commonly used, there’s no built in or standard tools for accessing flags?