Follow

I hate writing bash scripts.

The second I need to put things into variables it all falls apart.

@rune it's tricky, normally because we don't understand the underlying concepts of the shell. Did you ever study it in a theoretical level? It helps a lot.
I had many issues with it in the past and I feel like I improved a lot thanks to some understanding on the expansions, how they are applied, subshells and all that.

@ekaitz_zarraga certainly all my problems with bash is that I don't understand it.

Every time I fall back on my knowledge of real programming languages and I am always disappointed.

@rune yeah... i know the feeling. Try to read the manual from shell and you'll learn a lot about how it works. It's a life changer:

mkssoftware.com/docs/man1/sh.1

@rune I'd pay special attention to expansion and word-splitting. btw

@ekaitz_zarraga @rune I think the biggest source of confusion and weird design in shell languages are barewords. There are few programming languages in daily use where barewords are so commonplace. And when you actually don't want the bareword parsing logic, you need to do lots of quoting like "${variable}".

@samgai @rune yeah word splitting is a silent killer. It also happens after command substitution so it can kill you harder without noticing. :)

@ekaitz_zarraga @rune True. I make a habit of using "$(command)", but it does not stop feeling wrong.

@rune if you are using vscodium, install ShellCheck extension. It makes me look like a bash master in my team, even when I secretly hate bash too.

@rune for me it’s when i try to use functions, branching, loops, lists or boleans

Sign in to participate in the conversation
Mastodon

Mastodon Community of Denmark (MCD) for Danes and other people to talk about Denmark or whatever.