180
submitted 1 year ago by [email protected] to c/[email protected]

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

This post is from 2020-09-03.

you are viewing a single comment's thread
view the rest of the comments
[-] [email protected] 5 points 1 year ago* (last edited 1 year 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
[-] [email protected] 4 points 1 year ago* (last edited 1 year 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.

[-] [email protected] 2 points 1 year 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.

[-] [email protected] 1 points 1 year 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!

this post was submitted on 16 Jul 2023
180 points (97.4% liked)

linuxmasterrace

2166 readers
1 users here now

A community for Linux enthusiasts.

May your htop stats be low and your beard grow long

Welcome to [email protected] former r/linuxmasterrace members and existing Lemmyverse citizens: Feel free to join the newly created [email protected] community.

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

founded 1 year ago
MODERATORS