Live data from Hacker News

Bash 5.0 released

lists.gnu.org

181–190 of 306 posts

Re: Bash 5.0 released

#182

Earlier quoted context omitted.

What percent of Unices come with Powershell today? I can write my code in bash and forget about it. Or if I'm supporting less systems (most linux + macOS + most modern Unices) I can write my code in perl or python. Powershell? Thanks but no thanks.

> I can write my code in bash and forget about it. In practice, this approach often results in code that works only on Linux, or on Linux and macOS. I especially hate it when people shove #!/bin/bash as a shebang, and doubly so when it's in scripts that are a part of some npm package. (On BSDs, Bash is not installed out of the box, and when it is installed, it's not in /bin, since it's not in the base system.) Still,…

"#!/usr/bin/env bash" is the right way to do it, but "#!/bin/bash" is so common that I'd just symlink it there if it's not already present. Any reason why these OSes don't do it automatically?

Re: Bash 5.0 released

#183
post #70
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…

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…

This makes me think of PowerShell. Individual Cmdlets can be written in PowerShell itself or in any language that compiles to .Net IL, plus one has dire t access to the entire .Net framework.

Re: Bash 5.0 released

#184

Yet macOS is still on 3.2.

MacOS doesn't appear to ship GPLv3 licensed code. 3.2 is the last update on GPLv2. Alternatively - newer versions of ZSH are frequently provided by Apple.

What's wrong with shipping GPLv3 code? Can't they just provide the source (are they making significant changes that they want to keep proprietary?) to comply with the license?

Re: Bash 5.0 released

#185

Any recommended reading for Bash? I'm somewhat new to it and it's interesting ways of getting things done. I've used it minimally in the past, but have found myself writing a 100> LOC script, which I can't help but feel I'm likely over-complicating certain bits and pieces.

* look into parameter substitution https://www.tldp.org/LDP/abs/html/parameter-substitution.htm...

* use traps http://tldp.org/LDP/Bash-Beginners-Guide/html/sect_12_02.htm...

* read about safe ways to do things in bash https://github.com/anordal/shellharden/blob/master/how_to_do...

* this is pretty helpful writeup of general CLI usage, yet not bash specific https://github.com/jlevy/the-art-of-command-line (related HN discussion https://news.ycombinator.com/item?id=9720813)

Re: Bash 5.0 released

#186

Earlier quoted context omitted.

Here is my favourite bash script: https://blog.ashfame.com/2018/02/deploying-lambdas-multiple-... Deploy a lambda function in multiple regions (15 regions!) with just one bash script using Apex up. Add route53 on top with Latency Based Routing enabled and you've a latency in 10s of millsecond from anywhere on the globe without paying a hefty fee for this kind of latency.

How is that in any way related to the parent comment?

It's not my blog, i thought mentioning a script in bash would be a good idea.

Re: Bash 5.0 released

#188
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?

bash's EPOCHREALTIME was inspired by mksh, which was in turn inspired by zsh. And in zsh, EPOCHREALTIME was named after the system real-time clock (specifically the CLOCK_REALTIME clock ID passed to clock_gettime()). And i imagine that was named by analogy with hardware real-time clocks, since they both track human ('real') time. But i don't know much about electronics or the history of POSIX clock sources.

Re: Bash 5.0 released

#189

Earlier quoted context omitted.

> GNU projects tend have info pages that are a lot more complete and thorough then their man pages Why is that? Why don’t they build both from a single source?

Because they're structured differently. A man page for an app is just that, a page, with some formatting and sections. Texinfo is more like your typical website - lots of small cross-linked pages with a common index. Consequently, a man page is usually an extended take on --help, while info pages are more like product manuals. This is the theory. The practice is that GNU mandates Texinfo for its projects, and because…

They could easily just serialise the info pages under page headings and have that as an additional manpage.

Re: Bash 5.0 released

#190
post #53

Earlier quoted context omitted.

I assume you can install newer versions of Bash on macOS though? (But it certainly suggests to me that macOS isn't actually the easiest out-of-the-box solution if your workflow includes anything more than web browsing.)

On macOS almost everyone uses the homebrew package manager https://brew.sh . Installing bash is harder because you have to add the filepath of the new bash binary to /etc/shells and then set that filepath as your default shell, but brew install bash echo /usr/local/bin/bash | sudo tee -a /etc/shells chsh -s /usr/local/bin/bash and if you're on macOS and still haven't heard of homebrew, you first need to install it wi…

You probably don't need to update /etc/shells unless you really want to. chsh just won't let you switch to a shell that's not listed there without using sudo, which isn't a problem for most (generally single-user) Mac systems. You can also change your shell from the Users & Groups system preferences (in the advanced settings).
Post reply on HN