On Sat, Jan 2, 2016 at 5:59 AM, Gert Leenders <leenders.g...@gmail.com>
wrote:
>
> We need a translation of this bash line [[ $TMUX == *'tmate'* ]] && echo
> tmate || echo tmux
> to Fish
>

The simple part of the translation is replacing && with the "and" command
and || with the "or" command. So, step one (which isn't yet valid fish):

[[ $TMUX == *'tmate'* ]]; and echo tmate; or echo tmux

The harder part is the pattern match. If you use a fish built from github
source you can use the new "string" builtin command:

string match '*tmate*' $TMUX >/dev/null; and echo tmate; or echo tmux

With already released versions of fish you'll need to use grep:

echo $TMUX | grep -q '.*tmate.*'; and echo tmate; or echo tmux

-- 
Kurtis Rader
Caretaker of the exceptional canines Junior and Hank
------------------------------------------------------------------------------
_______________________________________________
Fish-users mailing list
Fish-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/fish-users

Reply via email to