Fish doesn't have a special syntax for a logical AND (&&) or a logical OR (||).
Instead, you can use the commands and and or, which verify the previous command's exit status and act accordingly:
Furthermore – just like in bash – you can use a semicolon ; to execute two commands one after the other:
I've never used fish myself but a cursory google search brought up this page which states that
Powerful History Mechanism
Modern shells save previous commands in a command history. You can view earlier commands by using the up and down arrows. Fish extends this concept by integrating the history search functionality. To search the history, simply type in ...
TL;DR: Make sure RVM is up-to-date to at least 1.26.11 by re-installing or issuing the command rvm get head, and is only being initialized once per terminal environment.
Eventually I was able to fix my environment. I will post some information pertaining to my specific problem in an effort to help some, even though others may have the same symptom ...
The 'fish' way of setting the $PATH variable is to actually use set --universal fish_user_paths $fish_user_paths /new/path/here. Then $fish_user_paths is actually prepended to the $PATH variable when a new session starts. The $PATH documentation doesn't currently tell you how to delete it though.
In fish every variable is actually a list (array), and you ...
You can use Bash to parse /etc/profile and ~/.profile, and then start fish.
Create /usr/local/bin/fishlogin with contents
exec -l fish "$@"
Make it executable
sudo chmod +x /usr/local/bin/fishlogin
Add it to /etc/shells
echo /usr/local/bin/fishlogin | sudo tee -a /etc/shells
Set it as your default shell
sudo usermod -s /usr/local/bin/...
First thing to point out is that you can do this via tmux completely independent of your shell. Add the following to your ~/.tmux.conf; for example:
set-option -g set-titles on
set-option -g set-titles-string "#S / #W"
Also, you need to ensure iTerm2 is configured to let programs set the title via an escape sequence. See the "Terminal may set tab/window ...
Unfortunately, the assumption that stderr is only used for error output isn't always correct. Rather, stderr is often used for any and all interactive output and diagnostics, i.e. output intended for the user to read in an interactive prompt1. wget and dd are well-known examples.
Some commands will provide a flag (e.g. -quiet or -silent) to suppress non-...
My current solution (see here for a maybe more recent version):
egrep "^export " ~/.profile | while read e
set var (echo $e | sed -E "s/^export ([A-Z_]+)=(.*)\$/\1/")
set value (echo $e | sed -E "s/^export ([A-Z_]+)=(.*)\$/\2/")
# remove surrounding quotes if existing
set value (echo $value | sed -E "s/^\"(.*)\"\$/\1/")
if test $var = "...
The logical operators you're used to, are supported since fish 3.0.0, released on 2018-12-28.
From the v3 release notes:
fish now supports && (like and), || (like or), and ! (like not), for better migration from POSIX-compliant shells (#4620).
I found this perfect answer on the fish-users mailing list:
switch (commandline -t)[-1]
commandline -t $history; commandline -f repaint
commandline -i !
switch (commandline -t)[-1]
commandline -t ""
Unix utilities send general messages to stdout, and error messages to stderr, so if we only want to see error messages, then it will be sufficient to suppress stdout so only stderr gets output to the console.
The way to do this (in both bash and fish) is to append >/dev/null to the command. This pipes stdout into nothingness, but stderr (with your error ...
Sorry, I'm not sure if I understand what you're asking. But if your question is how to set your abbr definitions on startup (and in a file that you can store in a repository and share between machines), you should use the file ~/.config/fish/config.fish which is Fish's equivalent to .bashrc in Bash.
Since abbreviations are stored in global/universal ...
Bash uses readline for interactive input, so syntax highlighting would need to be implemented in that program. I found a Google Groups discussion about how to code such a feature.
The fish shell uses its own line editor that is specific to that program, and can not be directly ported.
You may find that zsh is very similar to bash, and its line editor is ...
~/.config/fish/config.fish is empty by default. To create a custom prompt create a file ~/.config/fish/functions/fish_prompt.fish and fill it with your prompt.
echo (pwd) '> '
sudo !! (or sudo bang bang) is one of my most oft used commands. I'm still using just plain old bash that has it just fine. Sorry to hear that fish doesn't implement it correctly. A little googling and I found this:
if test "$argv" = !!
eval command sudo $history
command sudo $argv
There are a lot ...
As Elijah says, best practice is to modify the fish_user_paths rather than the global PATH. To avoid ever having to Google this again…
Create a couple of functions that only modify fish_user_paths
Make both functions autoloading
To add to user paths:
contains -- $argv $fish_user_paths
or set -U fish_user_paths $fish_user_paths ...
Did you remember to mark $GOPATH in fish as exported?
set -x GOPATH /home/<me>/workspace/go-workspace
It's not sufficient to test with
since that will work regardless of whether the variable is exported. Check with
bash -c 'echo $GOPATH'
which will only print the value of GOPATH if it has been exported. In bash, you export variables ...
For sourcing a general sh script in fish, one option is the bass plugin, which can source a bash script's environment variables into fish.
If you have fisherman, you can install it with fisher add edc/bass, then run bass source <command>.
If you found this question wondering how to change the window/tab title in fish, and the fish_title function works for you (see Chris Page's answer), then here's an example that sets the title to use a shortened version of your working directory.
$ funced fish_title
if [ $_ = 'fish' ]
Some settings, such as the color theme, are stored as universal variables. Run set -U to see them. Note that at the moment universal variables are stored in a file whose name is unique to each host. In the upcoming fish 3.0.0 release we're going to make that file truly global so that simply copying your ~/.config/fish directory tree to another machine will ...
fish doesn't implement incremental history search, although it seems to come up fromtime to time. The pre-2.0 documentation has a "Missing features and bugs" section 1 which lists incremental history search fairly far down in the "Possible features" list. The fish-users mailing list includes this message from Axel Liljencratz, dated August 21, 2006, in which ...
It looks like you want:
set -xg PATH /opt/local/bin /opt/local/sbin $PATH
Edit: I see what you mean, this syntax takes some getting used to. It wants spaces instead of colons, and it can't be in quotes, and all the paths in your current PATH must actually exist (in my case, I had /usr/local/sbin in my PATH even though it didn't actually exist, and that was ...