commit 10326385af89b8d96f62981d97b3986a117601f7 parent 54c989cc93a0521b4368e08020b55c1d169453f6 Author: Alex Balgavy <a.balgavy@gmail.com> Date: Tue, 23 Jul 2019 14:05:08 +0200 otp: don't show anything in the terminal Former-commit-id: e5e7304d36c799db01c5aadf8a12721e79e0b556 Diffstat:
M | scripts/otp | | | 11 | ++++++++++- |
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/scripts/otp b/scripts/otp @@ -1,3 +1,12 @@ #!/usr/bin/env bash # Generate OTP passwords (google authenticator alternative) -read -sp "Key: " k && oathtool --totp --base32 "$k" +read -sp "Key: " k +if command -v pbcopy &> /dev/null; then + oathtool --totp --base32 "$k" | pbcopy + echo "copied." +elif command -v xclip &> /dev/null; then + oathtool --totp --base32 "$k" | xclip -sel clip + echo "copied." +else + oathtool --totp --base32 "$k" +fi