Let me describe what I want to achieve. We are using two-factor authentication and I would like to create script which will generate TOTP token for me and it will paste it to let's say Firefox on some shortcut press. So I created a script like this
#!/bin/sh
echo $(oathtool --totp some-seed)
However if I assign shortcut for this script it's not able to print the PIN anywhere else other than the console. Ok, I know it was naive thing to try but what would be the best to achieve my goal?
sleep 0.4; oathtool --totp some-seed | xclip -selection clipboard; xdotool key ctrl+v
then assign a keyboard combination to launch the script. The sleep part is required (at least on Gnome). – don_crissti Dec 04 '14 at 18:50