I just learned about abbr and so I’m switching all my aliases from separate functions to just abbr
invocations. I assumed based on the documentation that I could add these all into ~/.config/fish/config.fish
by putting them in side an if status --is-interactive
check, but when I start up fish I see it attempting to run several commands. Any ideas how this would be happening? Below is a minimal version of my config.fish
that reproduces the error.
set PATH ~/.node/bin $PATH
set PATH ~/bin/ $PATH
set -x NODE_TLS_REJECT_UNAUTHORIZED 0
set JAVA_HOME $JDK_HOME
set GRADLE_USER_HOME ~/.gradle
if status --is-interactive
abbr --add -g build_clean ./gradlew clean build copyEar && docker-compose down --remove-orphans && docker-compose up --build
end
This results in
~/.config/fish/config.fish (line 8): The file 'docker-compose' is not executable by this user
abbr --add -g build_clean ./gradlew clean build copyEar && docker-compose down --remove-orphans && docker-compose up --build
^
from sourcing file ~/.config/fish/config.fish
called during startup
Quote the abbreviation expansion if it contains shell meta chars. Having said that the abbreviation you're having trouble with would seem better suited to be a function. Abbreviations are best suited for situations where you want something very short to expand into a command of modest length that you execute a lot and want the expansion in your history rather than a function name. For example, gcm
=> git checkout master
.