How do you “source” a file in fish?
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.
keychain fish
add a comment |
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.
keychain fish
add a comment |
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.
keychain fish
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.
keychain fish
keychain fish
edited Apr 22 '16 at 20:48
Elijah Lynn
63831025
63831025
asked Dec 17 '09 at 15:33
Lorin Hochstein
1,53042224
1,53042224
add a comment |
add a comment |
3 Answers
3
active
oldest
votes
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 .
.
@JohnMetta, see the link in the question and funtoo.org/wiki/Keychain. You'll need to install the program.
– jamessan
Feb 28 '13 at 2:11
Sorry, it was stupid of me to post that. I didn't actually want keychain- I was looking to replace the 'source' command, and didn't actually read. Using.
is what I needed.
– JohnMetta
Mar 1 '13 at 0:17
Thanks for including the[ -e $HOME/.keychain/$HOSTNAME-fish ]; and . $HOME/.keychain/$HOSTNAME-fish
line. That got my keychain to work and git to stop asking me for the passphrase every time I wanted to push.
– cjm
Aug 26 '16 at 18:34
add a comment |
The way recommended on the Keychain documentation page is to put this in config.fish:
if status --is-interactive
keychain --eval --quiet --quick path/to/id_rsa
end
Then, add this to the top of your script:
source $HOME/.keychain/(hostname)-fish
source: http://www.funtoo.org/Keychain
add a comment |
Use the source command:
source filename.txt
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "3"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f84615%2fhow-do-you-source-a-file-in-fish%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
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 .
.
@JohnMetta, see the link in the question and funtoo.org/wiki/Keychain. You'll need to install the program.
– jamessan
Feb 28 '13 at 2:11
Sorry, it was stupid of me to post that. I didn't actually want keychain- I was looking to replace the 'source' command, and didn't actually read. Using.
is what I needed.
– JohnMetta
Mar 1 '13 at 0:17
Thanks for including the[ -e $HOME/.keychain/$HOSTNAME-fish ]; and . $HOME/.keychain/$HOSTNAME-fish
line. That got my keychain to work and git to stop asking me for the passphrase every time I wanted to push.
– cjm
Aug 26 '16 at 18:34
add a comment |
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 .
.
@JohnMetta, see the link in the question and funtoo.org/wiki/Keychain. You'll need to install the program.
– jamessan
Feb 28 '13 at 2:11
Sorry, it was stupid of me to post that. I didn't actually want keychain- I was looking to replace the 'source' command, and didn't actually read. Using.
is what I needed.
– JohnMetta
Mar 1 '13 at 0:17
Thanks for including the[ -e $HOME/.keychain/$HOSTNAME-fish ]; and . $HOME/.keychain/$HOSTNAME-fish
line. That got my keychain to work and git to stop asking me for the passphrase every time I wanted to push.
– cjm
Aug 26 '16 at 18:34
add a comment |
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 .
.
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 .
.
edited Dec 6 at 2:09
answered Dec 17 '09 at 15:58
jamessan
981611
981611
@JohnMetta, see the link in the question and funtoo.org/wiki/Keychain. You'll need to install the program.
– jamessan
Feb 28 '13 at 2:11
Sorry, it was stupid of me to post that. I didn't actually want keychain- I was looking to replace the 'source' command, and didn't actually read. Using.
is what I needed.
– JohnMetta
Mar 1 '13 at 0:17
Thanks for including the[ -e $HOME/.keychain/$HOSTNAME-fish ]; and . $HOME/.keychain/$HOSTNAME-fish
line. That got my keychain to work and git to stop asking me for the passphrase every time I wanted to push.
– cjm
Aug 26 '16 at 18:34
add a comment |
@JohnMetta, see the link in the question and funtoo.org/wiki/Keychain. You'll need to install the program.
– jamessan
Feb 28 '13 at 2:11
Sorry, it was stupid of me to post that. I didn't actually want keychain- I was looking to replace the 'source' command, and didn't actually read. Using.
is what I needed.
– JohnMetta
Mar 1 '13 at 0:17
Thanks for including the[ -e $HOME/.keychain/$HOSTNAME-fish ]; and . $HOME/.keychain/$HOSTNAME-fish
line. That got my keychain to work and git to stop asking me for the passphrase every time I wanted to push.
– cjm
Aug 26 '16 at 18:34
@JohnMetta, see the link in the question and funtoo.org/wiki/Keychain. You'll need to install the program.
– jamessan
Feb 28 '13 at 2:11
@JohnMetta, see the link in the question and funtoo.org/wiki/Keychain. You'll need to install the program.
– jamessan
Feb 28 '13 at 2:11
Sorry, it was stupid of me to post that. I didn't actually want keychain- I was looking to replace the 'source' command, and didn't actually read. Using
.
is what I needed.– JohnMetta
Mar 1 '13 at 0:17
Sorry, it was stupid of me to post that. I didn't actually want keychain- I was looking to replace the 'source' command, and didn't actually read. Using
.
is what I needed.– JohnMetta
Mar 1 '13 at 0:17
Thanks for including the
[ -e $HOME/.keychain/$HOSTNAME-fish ]; and . $HOME/.keychain/$HOSTNAME-fish
line. That got my keychain to work and git to stop asking me for the passphrase every time I wanted to push.– cjm
Aug 26 '16 at 18:34
Thanks for including the
[ -e $HOME/.keychain/$HOSTNAME-fish ]; and . $HOME/.keychain/$HOSTNAME-fish
line. That got my keychain to work and git to stop asking me for the passphrase every time I wanted to push.– cjm
Aug 26 '16 at 18:34
add a comment |
The way recommended on the Keychain documentation page is to put this in config.fish:
if status --is-interactive
keychain --eval --quiet --quick path/to/id_rsa
end
Then, add this to the top of your script:
source $HOME/.keychain/(hostname)-fish
source: http://www.funtoo.org/Keychain
add a comment |
The way recommended on the Keychain documentation page is to put this in config.fish:
if status --is-interactive
keychain --eval --quiet --quick path/to/id_rsa
end
Then, add this to the top of your script:
source $HOME/.keychain/(hostname)-fish
source: http://www.funtoo.org/Keychain
add a comment |
The way recommended on the Keychain documentation page is to put this in config.fish:
if status --is-interactive
keychain --eval --quiet --quick path/to/id_rsa
end
Then, add this to the top of your script:
source $HOME/.keychain/(hostname)-fish
source: http://www.funtoo.org/Keychain
The way recommended on the Keychain documentation page is to put this in config.fish:
if status --is-interactive
keychain --eval --quiet --quick path/to/id_rsa
end
Then, add this to the top of your script:
source $HOME/.keychain/(hostname)-fish
source: http://www.funtoo.org/Keychain
edited Aug 10 '16 at 17:07
answered Jun 28 '15 at 20:41
Elijah Lynn
63831025
63831025
add a comment |
add a comment |
Use the source command:
source filename.txt
add a comment |
Use the source command:
source filename.txt
add a comment |
Use the source command:
source filename.txt
Use the source command:
source filename.txt
edited Aug 27 '16 at 3:50
Heptite
14.7k54157
14.7k54157
answered Aug 26 '16 at 20:16
Elijah Lynn
63831025
63831025
add a comment |
add a comment |
Thanks for contributing an answer to Super User!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f84615%2fhow-do-you-source-a-file-in-fish%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown