Live data from Hacker News

Bash Pitfalls

mywiki.wooledge.org

11–20 of 35 posts

Re: Bash Pitfalls

#11
post #3

Related: Bash Pitfalls - https://news.ycombinator.com/item?id=24401085 - Sept 2020 (111 comments) Bash Pitfalls - https://news.ycombinator.com/item?id=10068567 - Aug 2015 (38 comments) Bash Pitfalls - https://news.ycombinator.com/item?id=6790169 - Nov 2013 (54 comments) Common Bash Pitfalls - https://news.ycombinator.com/item?id=869560 - Oct 2009 (25 comments) Bash Pitfalls - https://news.ycombinator.com/item?id=5270…

I often see your "related" comment at the top of these posts and they mostly seem to match what shows up when you click "past". Would it make sense to automatically add a prominent link to the most recent or most commented on post in the header so you wouldn't have to copy & paste the links as comments?

I don't get this pervasive myth that dang is some kind of robot slave who lives on managed time and 'copies' and 'pastes' things- dang is a real person who types every letter and loves every second of it.

It's dang's choice to have two windows open- one with the comment box, and one with the 'past' page- and to read which ones have discussion with his human eyes, and then to type out the relevant information into the comment box. I'm vicariously offended that anyone would think this is a task that should, or even could, be even partially automated.

Re: Bash Pitfalls

#13

Earlier quoted context omitted.

I often see your "related" comment at the top of these posts and they mostly seem to match what shows up when you click "past". Would it make sense to automatically add a prominent link to the most recent or most commented on post in the header so you wouldn't have to copy & paste the links as comments?

I don't get this pervasive myth that dang is some kind of robot slave who lives on managed time and 'copies' and 'pastes' things- dang is a real person who types every letter and loves every second of it. It's dang's choice to have two windows open- one with the comment box, and one with the 'past' page- and to read which ones have discussion with his human eyes, and then to type out the relevant information into the…

come come, we all know dang is just a bot that PG made a long time ago ;-)

Re: Bash Pitfalls

#14

This and https://wiki.bash-hackers.org , #bash on irc (libera now) helped me tremendously on writing hardened scripts in production.

nice thanks for sharing! https://github.com/dylanaraps/pure-bash-bible >The goal of this book is to document commonly-known and lesser-known methods of doing various tasks using only built-in bash features. Using the snippets from this bible can help remove unneeded dependencies from scripts and in most cases make them faster.

> https://github.com/dylanaraps/pure-bash-bible

Interesting, although on a quick skimming most of the functions listed there are wrappers over... printf?

Re: Bash Pitfalls

#15
bash is a pitfall. In this world of IAC, powerful tools, unit testing, CICD, well crafted languages and libraries its a relic of an old time long gone.

Re: Bash Pitfalls

#16

Earlier quoted context omitted.

I don't get this pervasive myth that dang is some kind of robot slave who lives on managed time and 'copies' and 'pastes' things- dang is a real person who types every letter and loves every second of it. It's dang's choice to have two windows open- one with the comment box, and one with the 'past' page- and to read which ones have discussion with his human eyes, and then to type out the relevant information into the…

come come, we all know dang is just a bot that PG made a long time ago ;-)

Hahaha, I think you have it inverted. Dang is the person, PG is the bot.

Re: Bash Pitfalls

#17
post #15

bash is a pitfall. In this world of IAC, powerful tools, unit testing, CICD, well crafted languages and libraries its a relic of an old time long gone.

But practically everything unixy supports some shell variant that's similar to the others, so we have no choice in the matter. I compare this to PHP. They're both bad, PHP is a choice.

Re: Bash Pitfalls

#18
post #15

bash is a pitfall. In this world of IAC, powerful tools, unit testing, CICD, well crafted languages and libraries its a relic of an old time long gone.

and still it's the only one which is easily available everywhere and for the most part already in the allow/whitelist of tooling in most organizations as redhat and debian/ubuntu are almost everywhere.

Re: Bash Pitfalls

#19
(Disclaimer: I'm the co-developer)

Together with GitHub user xPMo, I created a Shellcheck REPL tool (https://github.com/HenrikBengtsson/shellcheck-repl) that validates your Bash commands using ShellCheck _before_ they are evaluated. For example,

$ words="lorem ipsum dolor" $ echo $words ^-- SC2086: Double quote to prevent globbing and word splitting.

It was a toy project at first, but since I've learned so much about Bash from using it, I now have it enabled all the time.

Re: Bash Pitfalls

#20
post #15

bash is a pitfall. In this world of IAC, powerful tools, unit testing, CICD, well crafted languages and libraries its a relic of an old time long gone.

there's just no way we should all be scripting in a language where typing out anything more than a single command necessitates a cascade of "well ACKshually it should be done this way" corrections, whether it's from a static analysis tools or your grey-bearded Bash-wizard coworkers.

We are eventually going to look at using bash and similar shells for scripting as the bad old days.

Post reply on HN