Shells

Hey, Sup Forums! Which shell do you use, and why? What do you like about it, compared to other shells? And most importantly, can you hear the ocean?

Other urls found in this thread:

mywiki.wooledge.org/BashGuide
gnu.org/software/bash/manual/html_node/index.html
mywiki.wooledge.org/BashPitfalls
github.com/TidOS/gshell
static.rust-lang.org/rustup.sh
wttr.in/brisbane'
wttr.in/
wttr.in/chengdu'
twitter.com/AnonBabble

bash because it just werks

for interactive: default one on system (bash, ksh, ash based on machine)
for scripting: posix shell, rc

What's so good about rc?

bash because it's everywhere and Im not a special snowflake.

zsh because menu select completion

it's actually fast, saner arrays, comfier syntax, and I install plan9ports everywhere anyway

dash for scripting (it's currently the fastest shell out there)
bash for interactive use and scripting where dash isn't enough (because it's the standard)

GNU Bash.

Also bash because it's the only I've read the entire manual for and the one I've been using for the longest time.

There's nothing that I've seen in zsh/fish that's worth spending the time to learn a new shell. I'll use ksh on some systems.

You can do that in bash, although it's not as powerful. It doesn't highlight the current entry or seperate commands and aliases. It's very usable though.

Even if you don't use bash you might want to do this because it affects all readline applications(you can make specific to a single one if you want). In .inputrc:

set menu-complete-display-prefix on
set show-all-if-ambiguous on

Tab: menu-complete

I would also recommend in .inputrc:

set colored-completion-prefix on
set colored-stats on
set completion-ignore-case on
set completion-map-case on
set match-hidden-files on

I like discussing shells so I'll bump this thread with something else.

A zsh thing that's not in bash is spell checking, you can hack your own in bash. Install a spell checker(aspell) and make it use commands. Also you can do whatever you want in command_not_found(), like adding package manager search(pacman in this case).

# based on pkgfile's /usr/share/doc/pkgfile/command-not-found.bash
_pacman_check() {
type pkgfile &>/dev/null || return

local pkgs
mapfile -t pkgs < /dev/null)

(( ${#pkgs[*]} )) || return

printf "%s may be found in the following packages:\n" "$1"
printf " %s\n" "${pkgs[@]}"
}

_spell_check() {
[[ -f ${BASH_ASPELL_DICT} ]] || return
type aspell &>/dev/null || return

aspell -d "${BASH_ASPELL_DICT}" -a --sug-mode=fast &2
_pacman_check "$@" && return
_spell_check "$@" && return
}

BASH_ASPELL_DICT can be something like ~/.cache/bash-aspell-dict. You can generate the list with something like:

while read -d: dir; do
for file in "${dir}"/*; do
[[ -x ${file} ]] || continue
basename -- "${file}"
done
done

I like zsh because of its autocompletion.

System Shell - dash
Interactive Shell - zsh

bash because when I do need to use it I have a qt girl(girl) guide me through using it.

Another interesting thing I don't seem to have anymore is that bash has HOSTFILE, so when readline sees that it needs to complete a hostname it can use those names to complete.

The way I had it rigged up was that I was using dnsmasq locally to cache DNS and I would periodically dump the cache to a file and use that as HOSTFILE. With it I could tab complete any domain I accessed recently.

I don't have it on this laptop but I should remake it.

That's really cool! I'm gonna give it a try.

fish because it just werks and muh autocompletion

Another thing, if you want, you could add to command_not_found_handle() is something that will run a file based on MIME type.

_mime_run() {
local prog

[[ -f "$1" ]] || return

case "$(file -b --mime-type -- "$1")" in
video/*|audio/*) prog=mpv ;;
image/*) prog=feh ;;
application/pdf) prog=mupdf ;;
text/*) prog="${PAGER}" ;;
# ...
*) return 1
esac

"${prog}" "$@"
}

So you can do:

~ $ *.mkv
# instead of
~ $ mpv *.mkv

Not super useful but it's kind of neat.

This guys knows what's up.

Ignoring 'current state of g doesn't know bash'
I would really like to learn some bash while on my break, could you recommend some good starting learning resources?

Zsh because I'm used to it now, and I don't know any bashisms
I also enjoy floating point support, lets me actually use my shell as a calculator

Start with wooledge then read/reference the GNU bash manual. Depending on your system it's probably accessable through

info bash

If you don't know how to use GNU info, either `info info' or use the online HTML version.

mywiki.wooledge.org/BashGuide
gnu.org/software/bash/manual/html_node/index.html

>current state of g doesn't know bash
It's not just Sup Forums, it's almost everybody who uses bash. They know how to type commands and use pipes but if you've ever seen the average shell script people shit out, it's obvious most of them don't know bash. It's also why wooledge has this page:

mywiki.wooledge.org/BashPitfalls

If you're wondering who Wooledge is, he's a kind autist who helps people with shell, kind of like what I'm trying to do but puts more effort in. He also does it on mailing lists instead of Sup Forums.

Best way to write hello world in bash?

Install the GNU hello program then simply run:

$ hello

No installing is allowed.

mksh is best shell, enjoy ur bloated zsh fags

zsh because it's like bash in that it just werks, but it's better

this guy knows what the fuck is up

the computer is meant to be customized by you to do stuff for you automatically, and the shell is the primary means of doing so.

csh

Why not Sup Forumsshell
github.com/TidOS/gshell

I put my aliases in a separate file called .aliases

here is a sample of my collection
alias showHiddenFiles='defaults write com.apple.finder AppleShowAllFiles YES && echo "shown"'
alias hideHiddenFiles='defaults write com.apple.finder AppleShowAllFiles NO && echo "hidden"'

alias shakeandbake='configure && make && sudo make install'

alias myip="ifconfig | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '$"
alias myextip='curl ipinfo.io/ip'
alias ipinfo='ifconfig | grep inet'

alias brewup='brew update && brew upgrade && brew cleanup'
alias convertalltomp3='find ./ -name "*.wav" -execdir lame -V -q 0 {} \;'
alias httpserver='python -m http.server'

alias save='git add * && git commit -m quicksave'
alias debug='lldb'
alias eterm='vi ~/.zshrc'
alias refterm='source ~/.zshrc'
alias ls='ls -Gh'
alias updateRust='curl static.rust-lang.org/rustup.sh | sudo sh'
alias updateRustNightly='curl -sSf static.rust-lang.org/rustup.sh | sh $'

# Funny stuff
alias we='curl wttr.in/brisbane'
alias wea='curl --silent wttr.in/ | head -7'
alias chengdu='curl wttr.in/chengdu'
alias ayy='echo lmao'
alias hello="echo let\'s get cracking"

alias gitgud='git push -u origin master'
alias save='git add * && git commit -m quicksave'

# Windows/Bootcamp
alias win='Volumes/BOOTCAMP/Users/gamerx/Desktop'
alias windows='/usr/local/bin/windows'
alias killvm='killall "VMware Fusion Start Menu"'

alias forceEmptyTrash='sudo rm -rf ~/.Trash/*'

alias octave='octave-cli'
alias raspi='screen /dev/tty.usbserial-AI02CWTB 115200'
alias antivirus='~/.clamscan_daily.sh'
alias avscan='~/.clamscan_daily.sh'

echo "Aliases loaded. Shell ready. "

Whatever's in the distro because I don't do complicated enough shit for it to matter

zsh because it just werks even better than bash which sometimes doesn't just werk unless you read the RTFM and spend an hour configuring it

To be honest with you, I copied all my zsh-specific configs from other people. I tried with bash configs but they all sucked in comparison.

and I script in ksh so

>using GNU

>he doesn't script in bourne shell

>echo "Aliases loaded. Shell ready. "
For what purpose?

autism

>I put my aliases in a separate file called .aliases
Isn't the standard convention?
Like on every system I've ever installed there was always a .bash_aliases file

Someone save me :(

/thread

>alias save='git add * && git commit -m quicksave'
Brainlet

cmd

Flandre Shell if you know what i mean :^)

But Flandre isn't a crab, baka yousei.