Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230
I have a 'dvb-t dab fm' usb stick thas has a IR receiver in it. With this receiver I can read the codes that are send from a remote control. In bash I use the command: '/usr/bin/ir-keytable -s rc0 -t'. This command waits for a button press and then shows the code in the terminal. It is stopped with CTRL-C.
Her is an example of the output:
/usr/bin/ir-keytable -s rc0 -t
Testing events. Please, press CTRL-C to abort.
653.122133: lirc protocol(rc5): scancode = 0xc toggle=1
653.122142: event type EV_MSC(0x04): scancode = 0x0c
653.122142: event type EV_SYN(0x00).
653.334160: lirc protocol(rc5): scancode = 0xc toggle=1
653.334169: event type EV_MSC(0x04): scancode = 0x0c
653.334169: event type EV_SYN(0x00).
^C
I would like to make a script that after each keypress show the protocol and the scancode. So I need to redirect the output to a variable. How can I do this?
peer wrote: ↑2023-08-25 15:13
So I need to redirect the output to a variable. How can I do this?
I think I would output to a file, likely append, then separately read the last line.
I've had this thought for dissecting am HD-Radio module that is partial figured out. Also, is the IR part of the dongle or a cabled in extra? I have a few such gadgets that were not recognized years ago and haven't played with them since. The hauppauge's I currently use have an IR section I should investigate someday...
<some command> |
while IFS= read -r line; do
<do something with $line>
done
Where each line of stdout from <some command> is placed in the variable $line.
Setting IFS (to null) should prevent word-splitting on spaces in the command output, similarly the '-r' option to read prevents interpretation of escape characters.
Many manuals and tutorials exist covering this.
Once is happenstance. Twice is coincidence. Three times is enemy action. Four times is Official GNOME Policy.
peer wrote: ↑2023-08-25 15:13
So I need to redirect the output to a variable. How can I do this?
I think I would output to a file, likely append, then separately read the last line.
I've had this thought for dissecting am HD-Radio module that is partial figured out. Also, is the IR part of the dongle or a cabled in extra? I have a few such gadgets that were not recognized years ago and haven't played with them since. The hauppauge's I currently use have an IR section I should investigate someday...
The IR is part of the dongle
I tried to redirect the output to a file. I tried both:
<some command> |
while IFS= read -r line; do
<do something with $line>
done
Where each line of stdout from <some command> is placed in the variable $line.
Setting IFS (to null) should prevent word-splitting on spaces in the command output, similarly the '-r' option to read prevents interpretation of escape characters.
I think redirecting does not work with the command '/usr/bin/ir-keytable -s RC0 -t'. The command listens to the remote control and gives output when a button is pressed on the remote. This is done during the execution of the command, not after.
I tried the scripting method:
Now the test.txt file is created and is showing the output but only after the command is finished. And I would like access to the output during the execution of the command