aboutsummaryrefslogblamecommitdiff
path: root/.local/bin/ssh-askpass.sh
blob: 879a882b606a6f2a25e27ad9deecd8c8ccb3bbd1 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16















                                                                                                                  
#!/bin/sh
# Remember to export SSH_ASKPASS=~/.local/bin/ssh-askpass.sh
RESULT=$(pinentry-curses --ttytype=xterm-color --lc-ctype=en_US.UTF8 --ttyname=/dev/tty <<END | grep -E '^(D|ERR)'
SETDESC Enter your SSH password:
SETPROMPT
GETPIN
END
)

if [ "$RESULT" = "ERR 111 canceled" ]; then
    exit 255
else
    length=$(printf "%s" "$RESULT" | wc -c)
    length=$((length))
    echo "$RESULT" : '..' | cut -c 3-"$length"   
fi