Live data from Hacker News

Pure Bash Bible (2018)

github.com

11–20 of 106 posts

Re: Pure Bash Bible (2018)

#11

Less critical then yesterday because of ChatGPT, I always expected to become fluent in bash at some point, but the AI became too good at writing my scripts now... Also you can use the chat as a learning tool, it's really a game changer for whom want to really learn it.

I think this is a trap for engineers inexperienced with Bash. You can (and should of course) use ChatGPT to be more productive in writing bash scripts, but as was said in the previous discussions, bash contains so many traps which you won't be able to spot.

Bash's dangers might be exacerbated by using ChatGPT, since you'll rely on the tool and you might not be able to understand what's wrong if shit hits the fan.

I'd recommend not using bash for anything other than the simplest tasks, as per Google's Shell style guide [0].

[0] https://google.github.io/styleguide/shellguide.html#s1.2-whe...

Re: Pure Bash Bible (2018)

#12

Earlier quoted context omitted.

The same amazing guy also published the Pure sh Bible: https://github.com/dylanaraps/pure-sh-bible

That's not dash, it's bash in POSIX compatibility mode. dash does not implement all the POSIX stuff in this "bible". Imagine using this "bible" to write a "pure sh" script thinking "this will be highly portable", only to have it fail because the Linux scripting shell is not bash in POSIX compatibility mode, it's dash. It would fail on NetBSD, too, whose scripting shell is the version of ash from which dash is derived…

> dash does not implement all the POSIX stuff

Then it doesn't sound fit for scripting.

Re: Pure Bash Bible (2018)

#13

Earlier quoted context omitted.

That's not dash, it's bash in POSIX compatibility mode. dash does not implement all the POSIX stuff in this "bible". Imagine using this "bible" to write a "pure sh" script thinking "this will be highly portable", only to have it fail because the Linux scripting shell is not bash in POSIX compatibility mode, it's dash. It would fail on NetBSD, too, whose scripting shell is the version of ash from which dash is derived…

Do people actually symlink /bin/dash to /bin/sh? That would be extremely stupid.

Debian and Ubuntu do it by default

Re: Pure Bash Bible (2018)

#14
Depending on your job description it is completely fine to not write shell scripts.

For anything bigger than a screenful of lines or something that would need proper unit testing or something that other people who are likely to be less versed in shell scripting need to maintain, think twice about using shell scripts.

Unixoid machines can use anything as scripts and using a language that breathes the programming language designs of the 1970s is not the best choice.

Re: Pure Bash Bible (2018)

#15

Less critical then yesterday because of ChatGPT, I always expected to become fluent in bash at some point, but the AI became too good at writing my scripts now... Also you can use the chat as a learning tool, it's really a game changer for whom want to really learn it.

What could go wrong? Use a technology that is notorious for outputting wrong information to write a script that is really hard to get it right and then later reviewed by someone that can’t really understand it.

At this point just use something else.

Re: Pure Bash Bible (2018)

#16
post #14

Depending on your job description it is completely fine to not write shell scripts. For anything bigger than a screenful of lines or something that would need proper unit testing or something that other people who are likely to be less versed in shell scripting need to maintain, think twice about using shell scripts. Unixoid machines can use anything as scripts and using a language that breathes the programming langu…

> or something that would proper unit testing

https://github.com/kward/shunit2>

Re: Pure Bash Bible (2018)

#18

Earlier quoted context omitted.

The same amazing guy also published the Pure sh Bible: https://github.com/dylanaraps/pure-sh-bible

That's not dash, it's bash in POSIX compatibility mode. dash does not implement all the POSIX stuff in this "bible". Imagine using this "bible" to write a "pure sh" script thinking "this will be highly portable", only to have it fail because the Linux scripting shell is not bash in POSIX compatibility mode, it's dash. It would fail on NetBSD, too, whose scripting shell is the version of ash from which dash is derived…

Do you have any specific examples to cite? The snippets are meant to be run in POSIX-compliant shells like dash/yash/ash/etc, not just Bash in compatibility mode.

In fact, there used to be a section which listed workarounds[1] for bugs in dash, but they have since been fixed[2]. If you are still using an old version of dash, you may need to use them.

[1] https://github.com/dylanaraps/pure-sh-bible/commit/70f410ebb...

[2] https://github.com/dylanaraps/pure-sh-bible/issues/13

Re: Pure Bash Bible (2018)

#20

Less critical then yesterday because of ChatGPT, I always expected to become fluent in bash at some point, but the AI became too good at writing my scripts now... Also you can use the chat as a learning tool, it's really a game changer for whom want to really learn it.

What could go wrong? Use a technology that is notorious for outputting wrong information to write a script that is really hard to get it right and then later reviewed by someone that can’t really understand it. At this point just use something else.

You say that likes writing code doesn’t involve experimentation in general. You can’t trust the code that that Chatgpt gives you, but you also can’t trust the code that even you write until you test it. It is always an iterative process. Why does it matter that some use AI tools as a starting point?
Post reply on HN