showkeyThe command showkey reads from console device. If you start showkeyshowkey from a subshell, you have to redirect stdin:
#!/usr/bin/env bash
/usr/bin/showkey -a </dev/stdin
In case you want to use timeout, just allow the command showkey to read from the TTY and get TTY signals:
#!/usr/bin/env bash
timeout --foreground 10 /usr/bin/showkey -a </dev/stdin