• 0 Posts
  • 208 Comments
Joined 2 years ago
cake
Cake day: July 7th, 2023

help-circle










  • hmm this gives me all colors (from ls and grep)

    /usr/bin/ls -l --color=always | /usr/bin/grep --color=always a
    

    (I’m using their full paths because I usually alias ls and grep to eza and rg respectively)

    There’s a export CLICOLOR_FORCE=1 you can try to avoid repeating --color=always, but that didn’t work for me with ls and grep specifically.

    Edit: there’s also a FORCE_COLOR=1 that is popular, but again, neither ls nor grep seem to care.







  • After tens of thousands of bash lines written, I have to disagree. The article seems to argue against use of -e due to unpredictable behavior; while that might be true, I’ve found having it in my scripts is more helpful than not.

    Bash is clunky. -euo pipefail is not a silver bullet but it does improve the reliability of most scripts. Expecting the writer to check the result of each command is both unrealistic and creates a lot of noise.

    When using this error handling pattern, most lines aren’t even for handling them, they’re just there to bubble it up to the caller. That is a distraction when reading a piece of code, and a nuisense when writing it.

    For the few times that I actually want to handle the error (not just pass it up), I’ll do the “or” check. But if the script should just fail, -e will do just fine.