Live data from Hacker News

Bash 5.0 released

lists.gnu.org

141–150 of 306 posts

Re: Bash 5.0 released

#142

What is the value in creating built-in replacements for binaries like rm and stat?

My guess is that it's less about performance so much as reliability. I've had three incidents in the last two years which required connecting to a server that had an out of control process pool that had exhausted pids.

I also had a storage controller go and had to figure out how to use shell builtins to create a tmpfs and reflash the firmware.

There are many reasons to provide builtins for basic file commands, from saving the extra process start to the tiny performance boost for scripts that should probably be using find instead.

Re: Bash 5.0 released

#143
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…

You can already do this interactively with PROMPT_COMMAND, e.g.

  PROMPT_COMMAND='date=$(date +%D);time=$(date +%T)'

Re: Bash 5.0 released

#144
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…

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.

Re: Bash 5.0 released

#145
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…

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.

Love Apex Up

Re: Bash 5.0 released

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

It's not obvious that just expanding a variable runs code though.

Re: Bash 5.0 released

#147
post #95
post #90

Earlier quoted context omitted.

> accidentally shipping it on iOS can be pretty dangerous I read the same argument about GPLv2 in like 1994. To date, there remains no case law I'm aware of where a copyright holder "lost" anything by "accidentally" shipping GPL software. How many decades does it take for us to put this myth to rest?

A lot, because it's hard to derive meaningful conclusions from something that's used so relatively little precisely because of licensing concerns. Anyway, with v2, the concerns were more vague - you'd have to accidentally link something GPLv2. With v3, even just shipping the binary signed with a private key on a platform that requires said key to load it, is enough to potentially force disclosure of that key (and tha…

The outcome of violating the GPL is license termination: you cannot distribute it any more. I don't think there has ever been a case of enforced further distribution or disclosure.

Re: Bash 5.0 released

#148

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.

Run https://www.shellcheck.net/ on all your bash code

Read https://mywiki.wooledge.org/BashGuide

Re: Bash 5.0 released

#149
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…

Please no. The parallel universe Me where I didn't happen to read this random thread would never know, consequently never expect random variables to do that. And curse you forever if I found out while banging my head debugging some buggy script.

Re: Bash 5.0 released

#150
post #41
post #36

Earlier quoted context omitted.

It's strange to me to imagine that there would be one language that was the best choice for OS implementation and day to day user interaction/automation. I'm curious what language do you think would be good for both use cases?

A more syntactically friendly Haskell-like language

So a ml like language like sml, ocaml or f#?
Post reply on HN