First time installing a distro that came with zsh instead of bash

3 years ago by muhyb to c/linuxmasterrace

I’m moving my posts from Reddit to Lemmy before delete them.

This post is from 2020-09-03.

Lemmchen 22 points 3 years ago

Okay, you guys get the once in a liftetime chance to convince me that Bash is not the way to go. I'll eagerly await your proposals.

path: 0 1344159, hotness: undefined, score: 22, children: 21
likeaduck 26 points 3 years ago

Zsh, an extended version of the Bourne Shell (sh), offers a plethora of compelling reasons why it surpasses Bash in terms of functionality and customization. Here are some key advantages of Zsh over Bash:

  • Plugin and theme support: Zsh boasts a wide range of plugin frameworks and themes, allowing users to enhance their shell experience and tailor it to their specific needs. The popular Oh-My-Zsh framework is a testament to the vibrant plugin ecosystem available for Zsh.

  • Automatic cd: Zsh simplifies directory navigation by enabling users to change directories simply by typing the name of the desired directory. This feature eliminates the need to type the "cd" command explicitly, saving time and keystrokes.

  • Recursive path expansion: Zsh offers the convenience of shorthand path expansion, allowing users to expand a partial path to its full form recursively. This feature proves particularly useful when dealing with nested directory structures.

  • Spelling correction and approximate completion: Zsh's intelligent auto-correction feature automatically fixes minor typos in directory names, ensuring smooth and error-free command execution. Additionally, Zsh's approximate completion feature suggests potential completions based on the entered command, further streamlining the workflow.

  • Syntax highlighting: Zsh goes beyond mere text display by providing syntax highlighting for command lines, making complex commands more readable and easier to comprehend. This feature enhances code visibility and reduces the likelihood of syntax errors.

  • Advanced scripting capabilities: Zsh offers a more powerful scripting language compared to Bash, enabling users to create intricate and sophisticated shell scripts. This flexibility opens up possibilities for automation and complex task execution.

  • Enhanced customization: Zsh provides users with extensive customization options, allowing them to personalize their shell environment to suit their preferences. From prompt customization to theme selection, Zsh empowers users to create a shell experience that aligns with their workflow and aesthetic choices.

While Zsh undeniably offers a wealth of advantages, it is worth noting that it has a steeper learning curve compared to Bash, especially for users unfamiliar with advanced shell features. Additionally, Zsh consumes more memory due to its more complex data structures and advanced functionality.

path: 0 1344159 1344342, hotness: undefined, score: 26, children: 12
Felix 5 points 3 years ago
path: 0 1344159 1344342 1364693, hotness: undefined, score: 5, children: 0
oktoberpaard 4 points 3 years ago

Some of those options exist in Bash too, but need to be enabled in your profile: https://www.gnu.org/.... Bash is also more like to be available on random machines that you have access to. Lastly, if you’re working a lot with Bash scripts in your (work) environment you might feel more at home using Bash in interactive mode too.

Those are just some counter arguments for the sake of completeness. I think zsh is great, even though I personally don’t use it (yet).

path: 0 1344159 1344342 1384178, hotness: undefined, score: 4, children: 0
zzz 3 points 3 years ago

OK GPT, now give me 7 reasons why Bash is better than zsh, please!

path: 0 1344159 1344342 1440164, hotness: undefined, score: 3, children: 1
gamma 2 points 3 years ago

Yeah, from the first line

Zsh, an extended version of the Bourne Shell (sh)

This screams AI-generated.

path: 0 1344159 1344342 1440164 1440290, hotness: undefined, score: 2, children: 0
argv_minus_one 2 points 3 years ago

Automatic cd: Zsh simplifies directory navigation by enabling users to change directories simply by typing the name of the desired directory. This feature eliminates the need to type the “cd” command explicitly, saving time and keystrokes.

What if there happens to be a command with the same name?

path: 0 1344159 1344342 1553798, hotness: undefined, score: 2, children: 5
Still 3 points 3 years ago

command goes first

order is shell built in > path > autocd

path: 0 1344159 1344342 1553798 1553799, hotness: undefined, score: 3, children: 3
argv_minus_one 2 points 3 years ago

Then you're likely to enter a command by accident. I would consider that a dangerous misfeature and look to turn it off.

path: 0 1344159 1344342 1553798 1553799 1553800, hotness: undefined, score: 2, children: 2
branchial 1 point 3 years ago

Don't name your directories "rm" or "fdisk" problems solved

path: 0 1344159 1344342 1553798 3305636, hotness: undefined, score: 1, children: 0
WIPocket 2 points 3 years ago

Automatic cd isnt a zsh-only feature. You can use it in bash by shopt -s autocd. Afaik its also disabled by default in zsh, just enabled by oh-my-zsh.

path: 0 1344159 1344342 1350039, hotness: undefined, score: 2, children: 0
cy_narrator 1 point 3 years ago
path: 0 1344159 1344342 2855475, hotness: undefined, score: 1, children: 0
gamma 6 points 3 years ago

There are two massive points no one has mentioned yet.

  • Quoting every expansion isn't necessary in Zsh. Parameters don't split or glob by default.
  • $array actually expands to every element in an array.

Compare this between Bash and Zsh:

a=('/* hello */' 'world!' '  ')
printf '"%s" ' $a
path: 0 1344159 1371697, hotness: undefined, score: 6, children: 3
Zucca 4 points 3 years ago

$array actually expands to every element in an array.

Very convenient. But ~every shell script is written in bash or POSIX(y) sh. When I need to write shell scripts I begin with busybox sh compability. If it turns out to be too complex, I'll convert to bash. This is because if I ever would publish the script it would have better changes to be accepted as a PR for example. Yes. Bash is a mess. I don't even like it that much. It's okay. But it's more standard then zsh. Although I've seen the tides turn on some occasions, like macOS.

Maybe some day I'll give zsh a second chance.

path: 0 1344159 1371697 1379198, hotness: undefined, score: 4, children: 2
gamma 2 points 3 years ago

I used to write Bash more than anything, but now the things I write are either simple enough to keep POSIX or complex enough that I miss the extra niceties Zsh provides.

path: 0 1344159 1371697 1379198 1379785, hotness: undefined, score: 2, children: 1
zzz 1 point 3 years ago

but now the things I write are either simple enough to keep POSIX or complex enough that I miss the extra niceties Zsh provides.

Well said!

path: 0 1344159 1371697 1379198 1379785 1440049, hotness: undefined, score: 1, children: 0
muhyb 3 points 3 years ago

Bash is the way, zsh if you are lazy.

path: 0 1344159 1344314, hotness: undefined, score: 3, children: 0
20gramsWrench 1 point 3 years ago

sh scripts can be run in even the dumbest distro out there, bash, not so much

path: 0 1344159 4726477, hotness: undefined, score: 1, children: 1
Lemmchen 1 point 3 years ago

The debate was between zsh and bash, not necessarily POSIX sh.

path: 0 1344159 4726477 4729509, hotness: undefined, score: 1, children: 0
BheemanRaghu 1 point 3 years ago

This is me but for fish shell.

path: 0 1344159 1439966, hotness: undefined, score: 1, children: 0
Thaurin 7 points 3 years ago

Try fish with the tide plugin and the fzf plugin. I can never go back to anything else.

path: 0 1343744, hotness: undefined, score: 7, children: 14
Melco 1 point 3 years ago
path: 0 1343744 1349267, hotness: undefined, score: 1, children: 5
Thaurin 3 points 3 years ago

The command-line completion features alone are worth it!

Watch this video for a short introduction of some of the features.

path: 0 1343744 1349267 1371150, hotness: undefined, score: 3, children: 4
Melco 1 point 3 years ago
path: 0 1343744 1349267 1371150 1382805, hotness: undefined, score: 1, children: 3
Thaurin 1 point 3 years ago

I’m not sure if it’s the tides prompt or standard fish, but it shows me a match from my history as I type. So it’ll get more accurate the more I type. Then I’ll just hit control-e and it’ll complete it! I used to use control-r in bash for that, but this is way faster and more fluent. Also, the fzf plugin has a much more useful control-r replacement with fuzzy searches, etc.

The only downside would be the stuff that you know and are used to in bash and have to figure out in fish, or if you need to write any scripts that are POSIX-compliant. But you can still script in bash, of course. Although the fish language is more readable, it’s still a new language to learn. So if you do lots of cool internal functions and loops on the bash command-line all the time, well either learn fish or you start a bash shell and do it there. It’s not like bash suddenly isn’t available anymore.

path: 0 1343744 1349267 1371150 1382805 1383200, hotness: undefined, score: 1, children: 2
samsy 1 point 3 years ago

I love fish, only it annoys me, if I want to run a bash script.

path: 0 1343744 1344470, hotness: undefined, score: 1, children: 7
Thaurin 2 points 3 years ago

Why is that? You can still use bash to interpret your bash scripts. Where does it annoy you?

path: 0 1343744 1344470 1371126, hotness: undefined, score: 2, children: 6
samsy 1 point 3 years ago

I have to switch to bash first, and wonder days later, why I can't find it (obviously) in my fish history.

path: 0 1343744 1344470 1371126 1372193, hotness: undefined, score: 1, children: 5
Thaurin 6 points 3 years ago

I mean, doesn’t the script have a hash bang pointing to the bash interpreter?

#!/usr/bin/bash

Or you can just run it like:

bash script.sh
path: 0 1343744 1344470 1371126 1372193 1372462, hotness: undefined, score: 6, children: 4
Nuuskis9 6 points 3 years ago

Which distro ships with zsh?

path: 0 1343244, hotness: undefined, score: 6, children: 4
zerstoerungsknall 1 point 3 years ago

Kali

path: 0 1343244 1349001, hotness: undefined, score: 1, children: 0
muhyb 1 point 3 years ago

I believe it was Manjaro Bspwm which doesn't exist for quite some time.

path: 0 1343244 1343520, hotness: undefined, score: 1, children: 0
Zucca 1 point 3 years ago

Not a distro but macOS does ship zsh but default nowdays.

path: 0 1343244 1379454, hotness: undefined, score: 1, children: 0
cyyypher 1 point 3 years ago
path: 0 1343244 1919410, hotness: undefined, score: 1, children: 0
vox 3 points 3 years ago

i prefer fish

path: 0 1623104, hotness: undefined, score: 3, children: 0
Xeelee 2 points 3 years ago

So what exactly is so great about it?

path: 0 1344191, hotness: undefined, score: 2, children: 1
muhyb 2 points 3 years ago

From my point of view, it's great because I'm lazy.

path: 0 1344191 1344318, hotness: undefined, score: 2, children: 0
Aldileon 1 point 3 years ago

What tool are u using for transferring your posts from reddit? Or is this done manual?

path: 0 1367050, hotness: undefined, score: 1, children: 1
muhyb 7 points 3 years ago

Automation can get you blocked from posting apparently, also I didn't have that many posts so I handpicked them.

path: 0 1367050 1368883, hotness: undefined, score: 7, children: 0
linuxmasterrace
linuxmasterrace

@feddit.de

login for more options
518
52
3

A community for Linux enthusiasts.

May your htop stats be low and your beard grow long

Welcome to !linuxmasterrace@feddit.de former r/linuxmasterrace members and existing Lemmyverse citizens: Feel free to join the newly created !linuxmasterrace@feddit.de community.

Let’s make the full transition to the decentralized Fediverse!

go to feed...