Live data from Hacker News

Bash 5.0 released

lists.gnu.org

161–170 of 306 posts

Re: Bash 5.0 released

#161
post #141
post #133

Earlier quoted context omitted.

What's the problem running it on a 10 year old bash?

all the 10 years of news and bug fixes?

Which is? And I doubt those scripts rely in the 'new' features out of some 30 years old history.

Re: Bash 5.0 released

#162
post #140
post #131

Earlier quoted context omitted.

How does function sound for a syntactic sugar? $ today() { date +%F; } $ echo Today, $(today) is a great day! Today, 2019-01-08 is a great day!

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).

Wouldn't "cat $today" result with "cat: No such file or directory: 2019-01-08"? Did you mean echo instead of cat?

Re: Bash 5.0 released

#163
post #76
post #66

Earlier quoted context omitted.

> If you want to tell the user how to invoke the program again, argv[0] is the right thing Some pedantry: it's actually not. The argv array is a completely arbitrary thing, passed by the caller as an array of strings and packed by the kernel into some memory at the top of the stack on entry to main(). It doesn't need to correspond to anything in particular, the use of argv[0] as the file name of the program is a side…

Sure, argv[0] is a just string, that the caller can set when they call execve(). That doesn't have mean that it doesn't have meaning. You are correct, there is no way to know how your executable was passed as the first argument to execve(). But, argv[0] is specified to mean roughly "welcome to the world, you are argv[0]", and to tell the program what it is. Sure, you could lie to the program, and tell it that it's so…

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 ?

Re: Bash 5.0 released

#164
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.

Re: Bash 5.0 released

#165
post #84

With this release, bash now has three built-in variables (um, I mean "parameters") whose values are updated every time they're read: $RANDOM yields a random integer in the range 0..32767. (This feature was already there.) $EPOCHSECONDS yields the whole number of seconds since the epoch. $EPOCHREALTIME yields the number of seconds since the epoch with microsecond precision. I'm thinking of a new shell feature that wou…

Anyone knows why a `microsecond since epoch` is named "realtime"? What is so "guaranteed" about it?

Re: Bash 5.0 released

#167
post #11

Why did we keep the language of the shell and the OS separate? It seems like a needless abstraction which creates more harm than good (read a shell script vs any other language). While I'm at it, why is the filesystem and syscall api not just part of a standard userland language? For example, the filesystem could be exposed like an object tree rather than some syscall ritual. The syscalls could just be invisible, whe…

(re: Bash-vs-OS integration) bash is a programming language like any other, and you could use anything with a REPL as your shell. Python should do. In fact, I'll try it right now.. Yes, it works. Just sudo chsh -s /usr/bin/python and off you go. Once you start doing this for a bit, you'll notice that the Python REPL is an incredibly poor UI for repeated execution of subprocesses. It is very elaborate. Having to const…

You may be interested in xonsh, a shell that supports both python and bash-like expressions: https://xon.sh/

Re: Bash 5.0 released

#169
post #163
post #76

Earlier quoted context omitted.

Sure, argv[0] is a just string, that the caller can set when they call execve(). That doesn't have mean that it doesn't have meaning. You are correct, there is no way to know how your executable was passed as the first argument to execve(). But, argv[0] is specified to mean roughly "welcome to the world, you are argv[0]", and to tell the program what it is. Sure, you could lie to the program, and tell it that it's so…

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.

Re: Bash 5.0 released

#170

Earlier quoted context omitted.

(re: Bash-vs-OS integration) bash is a programming language like any other, and you could use anything with a REPL as your shell. Python should do. In fact, I'll try it right now.. Yes, it works. Just sudo chsh -s /usr/bin/python and off you go. Once you start doing this for a bit, you'll notice that the Python REPL is an incredibly poor UI for repeated execution of subprocesses. It is very elaborate. Having to const…

You may be interested in xonsh, a shell that supports both python and bash-like expressions: https://xon.sh/

is this like fish?
Post reply on HN