Fork me on GitHub
#off-topic
<
2018-06-13
>
pesterhazy15:06:19

Bash scripting is a somewhat subtle art. I've written a highly opinionated guide: https://github.com/pesterhazy/blissful-bash. Feedback welcome

❤️ 4
dominicm15:06:43

I often throw in -E to set as well, but I can't remember why

pesterhazy15:06:42

Interesting, didn't know about that one

pesterhazy15:06:43

"If set, any trap on ERR is inherited by shell functions, command substitutions, and commands executed in a subshell environment. The ERR trap is normally not inherited in such cases."

pesterhazy15:06:35

Yes, it's different, -e applies across the board, -E makes sure traps are passed on to subshells

phronmophobic17:06:53

set -x can also be useful for debugging

Alex Miller (Clojure team)17:06:19

btw, one tool that definitely raised my game is https://www.shellcheck.net/ - just running that and understanding the warnings/errors really improved my bash

👍 4
dominicm17:06:50

shellharden is trying to augment spellcheck too

mg23:06:35

I wouldn't do that unless you're already really good at microservices

lilactown23:06:14

how do people do this in practice?

lilactown23:06:24

another option I thought of was a shared library, which might be possible since we could target JS + JVM

lilactown23:06:29

but that doesn't seem very future proof

lilactown23:06:38

the other option is just to add all of this biz logic to the data layer... which feels bad too

mg23:06:20

I've used shared libs before

mg23:06:59

It means you have to update all your targets when you change the business logic

mg23:06:41

If the rules change frequently this becomes unattractive, though

mg23:06:57

In practice, most of things I did this with never changed

mg23:06:26

The fewer things that you have to make network calls for, the easier life is

lilactown23:06:39

I 💯 agree with that. it just sucks feeling like you're implementing the same business rules... over and over and over 😅

lilactown23:06:00

I've worked on 3 teams in this company and implemented the same biz logic at least 5 times