How do you "source" a file in fish?

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 source $HOME/.keychain/$HOSTNAME-fish
end

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


Prior to fish 2.1.0, the source command was called ..


Use the source command:

source filename.txt

If the file you're trying to source contains bash, consider using Bass.

This will let you write, for example:

bass source ~/.bash_profile

Tags:

Fish

Keychain