Add on/off option to gpg_ssh

This commit is contained in:
Sam A. 2023-03-14 16:24:32 +01:00
parent ac2287dbfc
commit 3b25addae0
Signed by: samsapti
GPG Key ID: CBBBE7371E81C4EA
1 changed files with 7 additions and 1 deletions

View File

@ -28,7 +28,13 @@ get_ip() {
}
gpg_ssh() {
export SSH_AUTH_SOCK="$(gpgconf --list-dirs agent-ssh-socket)"
if [[ $1 == "on" ]]; then
export SSH_AUTH_SOCK_OLD="$SSH_AUTH_SOCK"
export SSH_AUTH_SOCK="$(gpgconf --list-dirs agent-ssh-socket)"
elif [[ $1 == "off" ]]; then
[[ -n $SSH_AUTH_SOCK_OLD ]] && export SSH_AUTH_SOCK="$SSH_AUTH_SOCK_OLD"
unset SSH_AUTH_SOCK_OLD
fi
}
http() {