I'm trying to add the following bash scripts to fish, yet am having trouble getting the syntax in fish right. Here is the original script:
export MINION_INSTALL=$HOME/minion
export NOTES_HOME=$HOME/Notes
export INBOX=$NOTES_HOME/inbox
if [ -d "$MINION_INSTALL" ] ; then
export PATH="$MINION_INSTALL:$PATH"
fi
source $MINION_INSTALL/aliases_for_minion
And this is the aliases_for_minion
file:
alias mn="minion"
alias icannotfind="minion --open --archive --full $@"
alias newnote="minion --new-note $@"
alias open="minion --open $@"
alias remind="minion --new-note --quick $@"
alias summary="minion --count inbox; minion --list --show-tags=False today; \
minion --count next; minion --count soon; minion --count someday"
The minion command works fine if I run fish after starting bash.
Any help would be greatly appreciated!
Best Answer
Here's some examples of what this would look like in fish:
Note the absence of the quotes, which is especially important in the line that sets PATH. Quoting it would collapse all of the paths in the list to a single entry, which is not what you want.
The aliases are valid in fish, except for the $@ at the end. fish has arguments as
$argv
, not$@
, but more importantly, any arguments are implicitly appended to the alias command. So you can just write:Then, for example,
newnote foo bar
will becomeminion --new-note foo bar
If you like, you can verify it with
functions newnote
, which will show you the function that the alias produced.Hope that helps!