I'm going to give it a go regardless but wanted to know if there were pitfalls and what people have done to alleviate them.
[0] https://wiki.archlinux.org/index.php/Fish#Troubleshooting
I'm going to give it a go regardless but wanted to know if there were pitfalls and what people have done to alleviate them.
[0] https://wiki.archlinux.org/index.php/Fish#Troubleshooting
It's not a deal-breaker, of course. If you become fluent in POSIX-shell you can translate between it and your custom shell, and things should be fine... but becoming fluent in two shells is a lot more work than becoming fluent in one shell.
If you never need to interact with other people's machines, and other people never have to interact with yours, then sure, go nuts and install whatever shell you want.
$ bash
And hey presto, back in bash land.I agree that it makes sense to know the lowest common denominator well before you go after something better—especially as you'll know straight away if and why it's "better".
Slightly OT, but I honestly think that "community best of" projects like oh-my-zss and the Vim ones actually do people a disservice since they are not zsh or Vim, but rather someone's opinionated, non-standard version of them.
The annoying case is vim plugins that use $SHELL to execute some bash/sh code. The workaround is to specify `set shell=sh` in .vimrc. We did not attempt to address this in fish (I didn't check but I would guess that tcsh is affected the same way).
The critical case is, at the login window, OpenSUSE invokes the login shell with a POSIX-ism (specifically 'exec "${@}"'), which was not recognized by fish. So setting fish as your login shell would lock OpenSUSE users out of their machines entirely!
What we did was hack fish to recognize exactly this command in its arguments, and handle it the way OpenSUSE expects, via a new function "fish_xdm_login_hack_hack_hack_hack". Heh.
The most annoying differences are the missing/changed special variables: POSIX has special $@/$* to return parameters: you have to use arrays for these in fish. POSIX puts exit status in $? and fish in $status; also $$ becomes %self, and there is no convenient way to expand to the PPID. Also annoying is the absence of "||" and "&&" operators.
Most of these differences, and why they were made, are explained in the manual.
$cmd1 && $cmd2 || $cmd3
becomes
$cmd1; and $cmd2; or $cmd3;
i.e., they're just commands that inspect $status and run their arguments.
$cmd1 || $cmd2 `$cmd3`
vs $cmd1; or $cmd2 `$cmd3`
If 'or' is 'just a command', I would think the shell would evaluate $cmd3 before calling $cmd2. Or are 'and' and 'or' built-ins that are similar to Lisp special forms/Forth immediate words?Edit: decided I wasn't that lazy today, and looked it up in the documentation. "and" and "or" are built-ins (http://fishshell.com/docs/2.0/commands.html#and, http://fishshell.com/docs/2.0/commands.html#or)
I reverted it back to bash and I get fish as my shell by spawning "urxvt -e fish" instead of "urxvt" (in my window manager configuration). This works well.
if status --is-interactive
set PATH ~/.local/bin /opt/local/bin $PATH
end
in your ~/.config/fish/config.fish file. Your other shells have the paths you want either because you configured them that way at some point, or because their global configs (e.g. /etc/bashrc) have broader paths. There's nothing magic going on here.Also, URLs with & don't work in bash anyway. Or rather, they will work, but do something you wouldn't expect - it would ignore & and everything after it, and run command in the background.
Please note that zsh works similarly to fish. Well, mostly. It seems that zsh has special logic that automatically inserts backslash before ? if it detects an URL. Perhaps that could be implemented in fish. But it also feels somewhat magical. Why "\?" would appear when I type "?"? But perhaps it's the best way. In your case, it's possible to break it. But the break looks really contrived, so perhaps zsh behavior would be safe.
[glitchmr@pineapple tmp]$ mkdir -p https://news.ycombinator.com
[glitchmr@pineapple tmp]$ touch https://news.ycombinator.com/itemsid=5723235
[glitchmr@pineapple tmp]$ wget https://news.ycombinator.com/item?id=5723235
--2013-05-17 13:39:09-- https://news.ycombinator.com/itemsid=5723235
Resolving news.ycombinator.com (news.ycombinator.com)... 184.172.10.74
Connecting to news.ycombinator.com (news.ycombinator.com)|184.172.10.74|:443... connected.
HTTP request sent, awaiting response... 404 Not Found
2013-05-17 13:39:10 ERROR 404: Not Found.