I'd like to use keychain with the fish shell, but I'm not sure how to get fish to load the ~/.keychain/hostname-fish file to set the appropriate environment variables.

In bash, there's the "source" command, but it doesn't exist in fish.

link|improve this question

feedback

1 Answer

up vote 1 down vote accepted

Below is what I have in ~/.config/fish/config.fish for your specific example.

set -gx HOSTNAME (hostname)
if status --is-interactive;
    keychain --nogui --clear ~/.ssh/id_rsa
    [ -e $HOME/.keychain/$HOSTNAME-fish ]; and . $HOME/.keychain/$HOSTNAME-fish
end

The source command is ., which also works in bash.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.