Created
February 7, 2022 14:06
-
-
Save subnut/1da1a4fe9c4b1836f7672b0df19a7b5b to your computer and use it in GitHub Desktop.
ssh-askpass using zenity
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
## Logging purposes | |
# PREVDIR=`pwd` | |
# cd "$(dirname "$0")" | |
# exec 1>./log.txt | |
# exec 2>./log_err.txt | |
# echo '$PREVDIR:' "$PREVDIR" | |
# echo '$1:' "$1" | |
# env | grep ^SSH_ | |
# Zenity interprets a single underscore as the 'mnemonic character' | |
# To print a single underscore, we need to have two underscores in the --text | |
# See: https://bugzilla.redhat.com/show_bug.cgi?id=1696157 | |
TEXT="$(echo "$1" | sed s/_/__/g)" | |
if [ "$SSH_ASKPASS_PROMPT" = confirm ] | |
then zenity --text="$TEXT" --title=ssh-askpass --question | |
else zenity --text="$TEXT" --title=ssh-askpass --entry --hide-text | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment