[zshrc] only run keychain for interactive sessions
This commit is contained in:
parent
0d88ee278a
commit
3db99de999
1 changed files with 4 additions and 1 deletions
|
|
@ -6,6 +6,9 @@ function mac() { [[ "$uname" = "Darwin" ]] }
|
|||
# check if a command is available
|
||||
function command_exists() { which "$1" >/dev/null 2>/dev/null }
|
||||
|
||||
# check if this is an interactive session
|
||||
# (tests if stdout is a tty)
|
||||
function is_interactive() { [ -t 1 ] }
|
||||
|
||||
# 1. Environment Vars
|
||||
# ===================
|
||||
|
|
@ -329,7 +332,7 @@ compinit
|
|||
|
||||
# 10. SSH Keychain
|
||||
# ================
|
||||
if command_exists keychain && [[ -d ~/.ssh ]]; then
|
||||
if is_interactive && command_exists keychain && [[ -d ~/.ssh ]]; then
|
||||
keychain --nogui ~/.ssh/id_rsa*~*.pub(N)
|
||||
KEYCHAINFILE="$HOME/.keychain/$(hostname)-sh"
|
||||
if [[ -f $KEYCHAINFILE ]]; then
|
||||
|
|
|
|||
Loading…
Reference in a new issue