Earlier quoted context omitted.
> have found myself writing a 100> LOC script Often, this is a good sign that you might want to switch to another scripting language.
That's true, so many times I have used shellcheck and started to improve a bash script, only to realize my time was better spent rewriting the script in Ruby.
Bash 5.0 released
111–120 of 306 posts
Re: Bash 5.0 released
#112As someone who lives in zsh and bash for interactive usage- I want to say- please do not write scripts in bash or zsh. Use powershell- its an amazingly well designed scripting language. Also- there is ammonite. Written for scripting.
Re: Bash 5.0 released
#113Earlier quoted context omitted.
Thank the GPL v3 for that one. Same reason GCC is frozen at 4.2.1 on mac. I switched to zsh, personally - the one Apple ship is pretty current. macOS is still a pretty solid developer machine.
Some application still requires bash, like wireguard
Re: Bash 5.0 released
#114With 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…
$RANDOM is new in bash 5.0? i'm curious. This has been documented for ages, afaik. headtilt
Re: Bash 5.0 released
#115Earlier quoted context omitted.
The full manual is here. https://www.gnu.org/software/bash/manual/bashref.html GNU projects tend have info pages that are a lot more complete and thorough then their man pages, so that'd be a good place to check too.
> 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?
This is the theory. The practice is that GNU mandates Texinfo for its projects, and because documentation tends to be the weak spot for all open source projects, manpages end up the most neglected as a result, which can be quite annoying. Especially since pretty much nobody else uses Texinfo - man pages are good enough for most console apps, and those that need more detailed documentation use Docbook, Markdown etc.
Re: Bash 5.0 released
#116With 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…
dualbus@system76-pc:~$ ksh -c 'date=; date.get() { .sh.value=$(date +%s); }; echo $date; sleep 5; echo $date'
1546926637
1546926642
See: https://docs.oracle.com/cd/E36784_01/html/E36870/ksh-1.html ("Discipline Functions")Re: Bash 5.0 released
#117Earlier quoted context omitted.
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…
Right, so the risk can't be quantified and the whole thing is just isomorphic "because I don't like it". Which was as true then as it is now. It's not about license terms, it's about what amounts to politics.
The big players in the industry did just that, and there appears to be a remarkable consensus on it.
Re: Bash 5.0 released
#118As someone who lives in zsh and bash for interactive usage- I want to say- please do not write scripts in bash or zsh. Use powershell- its an amazingly well designed scripting language. Also- there is ammonite. Written for scripting.
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.
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, though, that's a good reason to stick to the original Bourne shell. Powershell, whatever its advantages may be, simply has too heavy dependencies on Linux, since you're dragging in CLR. At that point, like you said, might as well just use Perl or Python for scripting.
Re: Bash 5.0 released
#119With 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…
$RANDOM is new in bash 5.0? i'm curious. This has been documented for ages, afaik. headtilt
Re: Bash 5.0 released
#120Earlier quoted context omitted.
The problem is that GPL3 has more restrictions than just "publish the code". That's why projects such as FreeBSD, OpenBSD, etc. also won't include GPL3 code, as including GPL3 code would restrict what you can and can't do with the entire system. I assume that Apple's reasoning is similar.
On FreeBSD, as I recall, they don't want any GPL'd code in the base system, simply because the ideological goal is to have everything under BSDL. It's not that it affects other bits of the system though.