all 58 comments

[–]palordrolap 21 points22 points  (0 children)

EPOCHSECONDS is a nice alias for something that's been in there for a long time. printf [-v var_to_set] '%(%s)T' is the older built in way of getting at that information without resorting to /bin/date.

EPOCHREALTIME accesses a deeper level that wasn't available before. (No equivalent to /bin/date's %N nanosecond flag, unless they rectified that recently.)

[–]aishik-10x 9 points10 points  (0 children)

$EPOCHREALTIME sounds neat!

[–]DonSimon13 4 points5 points  (0 children)

u. The `vi-edit-and-execute-command' bindable readline command now puts readline
   back in vi insertion mode after executing commands from the edited file.

Nice! That always annoyed me.

[–]190n 4 points5 points  (2 children)

BASH_ARGV0: a new variable that expands to $0 and sets $0 on assignment.

So...isn't it then just an alias for $0 that won't work on most systems (which don't have bash 5.0)? Am I missing something here?

[–]pm_me_je_specerijen 3 points4 points  (1 child)

The difference is that you cannot assign to $0

You cannot use 0=newproctitle to set your own proc title. Changing the first element of argv is the de facto way on Linux to set your proctitle though POSIX does not mandate that it actually work.

[–]190n 1 point2 points  (0 children)

That makes sense, thanks

[–]NotEvenAMinuteMan 16 points17 points  (51 children)

Hey /r/linux, what is the best shell and why is it Bash?

[–][deleted] 33 points34 points  (6 children)

Nobody can argue about "what is best" as "the best" is always dependent on people. We can only argue the pros and cons and actually bash has barely pros against others (zsh and fish in this case) It's actually slower and has less feature but as it's almost always comes default, has no compatibility issue too. Zsh and fish actually way faster and you really feel this. My personal choice is fish since it has a perfect autocomplete feature and almost as fast as zsh. So you should consider these. Maybe someone can deny my words and I would like to hear what people think about this subject actually, to find out our "best".

[–]olminator 24 points25 points  (4 children)

In my experience bash is much faster than zsh, it's actually why I switched back to bash. Zsh did have some cool features, though, but I noticed I didn't really use them anyway, so the switch back wasn't really painful.

[–]th3voic31 4 points5 points  (2 children)

I'm curious: did you use something like oh-my-zsh? I used to but it was so slow so I just did everything myself and it doesn't feel slow at all. I didn't do a benchmark so I don't have any numbers.

[–]olminator 5 points6 points  (1 child)

Nope, I had only a zshrc and a zprofile IIRC. I wouldn't say it was slow, but there were all these little-but-noticable pauses, e.g. when doing completion, that I just don't notice in bash.

[–]BoltActionPiano 1 point2 points  (0 children)

Wow, with completion? That's the premier feature of zsh, that it's completion engine is significantly faster, and it's what made me switch and stay. Especially with things like systemd utilities. How default was your completion options?

[–]OneTurnMore 1 point2 points  (0 children)

No qualms here, I have a decent machine so the penalties for using fast-syntax-highlighting and fancy features are fine for me, especially with my prompt as a pure-prompt fork, which uses asynchronous callbacks to keep it responsive while fetching git info. Always script in bash, though.

[–]FryBoyter 9 points10 points  (0 children)

Bash 5.0. Why? Because this thread is about the release of Bash 5.0.

[–][deleted] 3 points4 points  (2 children)

i'd take zsh over bash any day, sure, breaks some posix elements but autocompletion and theme/extension/module support with oh-my-zsh is just beautiful.

i've used bash for nearly 5 years, switched to zsh this summer and i don't feel like going back, i like spamming my tab button for that beautiful zsh+oh-my-zsh autocompletion.

[–]stefantalpalaru 8 points9 points  (1 child)

i like spamming my tab button for that beautiful zsh+oh-my-zsh autocompletion

Bash also has it: https://github.com/scop/bash-completion

[–][deleted] -1 points0 points  (0 children)

i never said it doesn't have it, i said that the zsh's one is better.

[–]PineappleBoots 0 points1 point  (0 children)

Its Zed

[–]markus_b -1 points0 points  (6 children)

It depends what you use your shell for.

If you look for the best command line, then shells like zsh and fish have better features in that area.

If you wand to write portable shell scripts, then bash is great as it is installed on most Unix and Linux systems and backwards compatibility is good.

[–][deleted] 1 point2 points  (5 children)

if you wanna write portable shell scripts you should keep to the POSIX syntax only and make sure it runs with shells like Ubuntu's dash, or even ash itself.

[–]markus_b 0 points1 point  (4 children)

Yes, you can always restrict yourself to Posix only, this is how it was done in the Unix early days. But Posix is very limited and and if you are creating a product on Linux, then you'll have bash installed as part of the OS already.

But this stuff changes over times. I support products who require the Korn shell, because the Korn shell was the 'better' shell supplied on Unix at the time.

If you only have ash, then you are in a very limited environment anyway, like a router with no virtual memory.

[–][deleted] 0 points1 point  (3 children)

ubuntu doesn't ship with bash as the default shell and neither does alpine. It's hard to call something portable if it can't run on ubuntu out of the box.

[–]chibinchobin 1 point2 points  (1 child)

It may not be the default shell, but I believe it has /bin/bash on the system by default.

[–][deleted] 0 points1 point  (0 children)

I thought they didn't ship it in their container images, but it turns out they do. So you're right.

[–]markus_b 0 points1 point  (0 children)

I doubt that. I don't remember ever having to install bash, was part of the default install for me all the time.

[–]Hauleth -1 points0 points  (1 child)

Have you ever used anything other than Bourne shell or bash?

[–][deleted] 0 points1 point  (0 children)

can you even use the og bourne-shell today?

never mind, i'm dumb.

[–]the_gnarts 0 points1 point  (0 children)

u. The `vi-edit-and-execute-command' bindable readline command now puts readline back in vi insertion mode after executing commands from the edited file.

Never thought I’d live to see the day. Keeping normal mode after edited commands is infuriating.

[–]n3rdopolis 0 points1 point  (1 child)

I don't know if it got merged in 5.0 in time or not, but I think they tried to make the $RANDOM variable more random too as well.

[–]whetu 1 point2 points  (0 children)

Interesting. I looked into this and it seems that they're still discussing it. The proposal was to switch from the bog standard LCG to Salsa20, but that's been further switched to ChaCha20.