Skip keychain without skipping the rest of .profile

1

I am using the keychain ssh-agent wrapper from funtoo.org.

I have it loaded automatically by adding an eval line in my .profile. E.g.:

eval `keychain --eval id_rsa github bitbucket`

Sometimes, I log into the login shell for the first time (e.g. after a reboot) and don't want to be bothered with typing the passphrases to add the keys to ssh-agent right away because I'm lazy and I know I won't be using SSH during that session.

If I press Ctrl-C, keychain and the whole rest of the .profile is skipped.

Is there a built-in way to skip keychain without skipping the rest of .profile?

My shell is Bash, by the way.

Kal

Posted 2014-06-18T03:16:16.093

Reputation: 533

Answers

2

Insert this line in your .profile before your eval ... line.

trap "echo -e '\nkeychain skipped'" SIGINT

You can still skip your eval ... with Ctrl+C. trap catch your Ctrl+C, show some text and then continue in your .profile.

Cyrus

Posted 2014-06-18T03:16:16.093

Reputation: 4 356