Live data from Hacker News

Bash 5.0 released

lists.gnu.org

251–260 of 306 posts

Re: Bash 5.0 released

#251
post #38

Earlier quoted context omitted.

A use-case I've long wanted it for is better "--help" messages. If you want to tell the user how to invoke the program again, argv[0] is the right thing: Given: #include int main(int argc, char *argv[]) { printf("Usage: %s [OPTIONS]\n", argv[0]); return 0; } Running it as `./dir/demo --help` gives: Usage: ./dir/demo [OPTIONS] Put it somewhere in $PATH, and run it as `demo --help`, and it will give: Usage: demo [OPTIO…

Personally, I just don't bother trying to show the user their particular invocation: #!/bin/bash echo "Usage: $(basename $0) [OPTIONS]"

Yes, that's what we've been stuck doing, because the full path included in $0 is useless if the program was run via $PATH.

Re: Bash 5.0 released

#252
post #163

Earlier quoted context omitted.

Surely the user already knows how to invoke the program, since he/she did it literally two seconds ago. What if I invoke it from a distant path, do I want my 73 character long path to be prepended in the --help ?

Especially on something like NixOS, where /bin/bash is actually /nix/store/3508wrguwrgu3h5y9354rhfgw056y-bash-5.0/bin/bash.

Do note that was my complaint with $0, that when using $PATH it was set to that full gross path.

If /bin/foo is actually /nix/store/3508wrguwrgu3h5y9354rhfgw056y-foo-5.0/bin/foo, then when you run "foo", 0="/nix/store/3508wrguwrgu3h5y9354rhfgw056y-foo-5.0/bin/foo" and BASH_ARGV0="foo".

Re: Bash 5.0 released

#253
post #140

Earlier quoted context omitted.

It's not as nice, "cat $today" is easier to type than "cat $(today)" and would give better completion, just declared matching variables instead of matching functions, files and executables. On the plus side, TIL the subshell syntax plays well with eval/expand shortcut (ctrl+alt+e).

* "cat $today" is easier to type than "cat $(today)"* Except you should really be in the habit of typing "cat ${today}" ;)

Why? The {} doesn't prevent glob expansion or field separation.

Re: Bash 5.0 released

#254
post #41

Earlier quoted context omitted.

A more syntactically friendly Haskell-like language

That’s great for developers who are competent in that paradigm but what about hobbyists or sysadmins who have little interest in software development? I’m not saying POSIX shells are without fault but they weren’t just created because C is too low level; they were created because people used a terminal who weren’t always techies so Bell Labs created a language which anyone could easily write simple programs with. Gra…

Yeah I never understood why many people, at least among programmers, seem to be strongly opposed towards shell and shell scripts.

At some point when I wasn't proficient enough in Bash yet, I was writing scripts for automation using Perl and Ruby. The 'logic part' is definitely much easier in these languages. But simple file/directory stuff is far more complex actually. A lot of this has to do with error handling and different expectations how that is supposed to work. In a default shell script, errors are handled very forgivingly which is very much how most people work when performing tasks manually - not every step is super important.

On the other hand Shell scripting documentation is crap. Most of it is from 80s/90s, full of irrelevant details for the practical person. A bit like 90s/00s JS documentation before MDN.

Re: Bash 5.0 released

#255

It's sad that lists.gnu.org is running obsolete TLS 1.0 crypto with weak 1024-bit DH. Either upgrade to TLS 1.2 with reasonable cipher suites, or just go back to plain HTTP.

Since I'm clueless on the subject, can I ask how you determined that information and what resource I could use to become better informed?

Re: Bash 5.0 released

#256
post #77
post #70

Earlier quoted context omitted.

That was kind of the idea of Unix. C was just a nicer from Assembly. You might write a performance-sensitive or low-level routine in C, much like you might drop to C when writing a Python library. But the high-level language of the system was the shell. The `dc` executable wasn't just meant to be a user-facing calculator program, it was also meant to be the system's "bignum" library. That was big-picture Unix. The sy…

Good insight, thank you

On the same line, let me recommend you a book: "The Design of the Unix Operating System," by Maurice J. Bach. If I am not mistaken, Mr. Bach was a member at Bell Labs.

My personal take on the book is that the kernel was meant to be a portable virtual machine, extensible through processes, and that those would be the building blocks of user applications for which the shell would act as glue.

In other words, the shell and the OS are separate because most of what we commonly call "the OS" may be interpreted as mere encapsulation of less versatile hardware architectures.

Re: Bash 5.0 released

#257
post #226

Seeing this release makes me cringe. I've used Bash as an interactive shell for decades but really I'm sick and tired of it. As a scripting language, I loathe it and really don't understand its purpose. I always write shell scripts in POSIX shell for portability reasons. Most of the time I don't need to use any of Bash's features. In cases where advanced features are needed and portability is not a concern, there are…

I switched to fish around 2010-2011, and I have never looked back. I’ve never had to set anything else besides my personal functions. These days it’s even faster and much more stable, and I’ve had so much more practice that I know all keyboard shortcuts and understand a lot of its inner workings.

Re: Bash 5.0 released

#258

Earlier quoted context omitted.

Powershell has been around for quite a while now, but only recently could you rely on it being installed on Windows systems, let alone be available on Linux. Maybe in another decade, but if you are targeting Unix-like systems bash is probably still your safest bet for portable, interpreted code. Python2 is a close second.

POSIX sh is your safest bet for portable, interpreted code.

[deleted]

Re: Bash 5.0 released

#259
post #226

Seeing this release makes me cringe. I've used Bash as an interactive shell for decades but really I'm sick and tired of it. As a scripting language, I loathe it and really don't understand its purpose. I always write shell scripts in POSIX shell for portability reasons. Most of the time I don't need to use any of Bash's features. In cases where advanced features are needed and portability is not a concern, there are…

If you're on Ubuntu, you could switch to dash. It's installed by default, and /bin/sh symlinks to it.

Re: Bash 5.0 released

#260
post #135

Earlier quoted context omitted.

The remarkable consensus behind IBM's purchase of Red Hat, you mean? Seems like their highly paid lawyers were down with it. Again, it's just stunning the extent to which this FUD hasn't changed at all over a quarter century.

The GPLv3 was intentionally designed to create the risk that Apple and others are trying to avoid. IBM doesn't have that risk because they don't sell hardware or software packages, they sell expensive service contracts.

Red Hat, a division of IBM, literally does almost $3B of revenue selling a Linux distribution that includes almost the entirety of the GNU corpus, all GPLv3. IBM bought them because they already resell packages and contracts based on the same stuff and wanted the vertical integration. So yeah, you buy an expensive service contract from IBM and it comes with (gasp) a giant license for GPLv3 stuff in RHEL.

That point is silly. If what you say were true, then the purchase would have been poison. It's not true. It's FUD. And it's hilariously the same FUD that people were flinging around in years before most of the existing FUD-flingers were even born.

Post reply on HN