this post was submitted on 01 Dec 2024
411 points (99.0% liked)

Bash

769 readers
1 users here now

Talk about the Bash Shell and Bash scripting

founded 4 years ago
MODERATORS
 
you are viewing a single comment's thread
view the rest of the comments
[–] aberrate_junior_beatnik 7 points 1 week ago (2 children)

The most useful bash command of all: sudo apt-get -y install zsh; chsh -s zsh; exec zsh ;)

I kid, I kid! I actually like bash a lot. I really prefer it for scripting. Arrays are extremely useful but not specified in posix. Bash is pretty ubiquitous though.

I'm also curious if there are any bash partisans who prefer it over zsh and for what reasons.

[–] [email protected] 7 points 1 week ago (2 children)

I actually prefer fish, but I want to learn more bash because is is ubiquitous and a lot of bash stuff also works in fish.

[–] [email protected] 3 points 1 week ago (2 children)

You may also like NuShell. It's been designed from the ground up to be an intuitive and convenient shell language.

[–] [email protected] 5 points 1 week ago (1 children)

Wait, the other shells were designed to be obtuse and inconvenient? /s

[–] [email protected] 2 points 1 week ago* (last edited 1 week ago)

Haha whoops, didn't want to imply that. I meant to say that it's intuitive for me, who finds bash syntax cryptic.

[–] ziggurat 1 points 1 week ago (1 children)

Can you tell me how to run a command and ignore an alias in NuShell? I don't really use nu but when i tried to write something in it, this was something that eluded me

[–] [email protected] 4 points 1 week ago (1 children)

Oh, if you want to avoid running a built in command like ls or cp and want to run the actual thing in /usr/bin, you prefix it with a ^, so eg ^cp -p.

[–] ziggurat 1 points 1 week ago* (last edited 1 week ago) (1 children)

Interesting. What does the ^ do in this situation?

And I just want to not respect an alias, so falls back to either builtin or path.

In zsh or bash I can prefix the command with the word command, or a backslash (directly before the command)

[–] aberrate_junior_beatnik 2 points 1 week ago

Fish is great! I used it for a while a long time ago but I ended up stopping because a few tools expected your shell to be set to something posix compatible. I wonder if the support is better now, I should give it a shot

[–] ziggurat 3 points 1 week ago

I'm a serious bash scripter, I mean I do it both at work and as a hobby. And zsh arrays are better. Like you can use negative indecees and stuff. I have only written shell functions in zsh (my primary shell), and not thousands of lines of scripts like I have for bash. But if zsh had as good documentation and language servers I'd probably do many scripts in zsh instead. But I can't say for certain, as I am not as sure about performance in some situations and stuff.

Why don't I use posix shell if I care about performance? Because they are only faster in very simple scripts,