I am bit puzzled, when I run this showkey -a command on shell, the command is run and I can interact with it in realtime.
See below
timeout 10 /usr/bin/showkey -a
Press any keys - Ctrl-D will terminate this program
t 116 0164 0x74
a 97 0141 0x61
s 115 0163 0x73
d 100 0144 0x64
f 102 0146 0x66
g 103 0147 0x67
j 106 0152 0x6a
f 102 0146 0x66
k 107 0153 0x6b
l 108 0154 0x6c
d 100 0144 0x64
Now when I add this command in a shell script, I do not see any output, or in other words I cannot interact with script or command that is run inside the script.
Here is my bash script.
#!/bin/bash
timeout 10 /usr/bin/showkey -a
exit 0
When I run this script, it waits for 10 seconds and exit to the shell. How can I make it show keys pressed, codes and interact with the user.
The reason I want this because the script has to execute many tasks before coming to keyboard testing and after keyboard test there are various other tasks that the scripts performs. I couldn't find any answers anywhere, so as a last resort I had to ask this question here. I hope someone can help.