How to automate a keystroke to a cli terminal appilcation like ranger?
2
votes
1
answer
288
views
I'd like to send a keystroke to ranger, when I have ranger running and have gotten it's PID with:
Output of
However when I press
ps aux | grep '[/]usr/bin/python -O /usr/bin/ranger'
:
chris 5054 3.1 0.1 116248 27828 pts/0 S+ 16:57 0:00 /usr/bin/python -O /usr/bin/ranger
Following from https://serverfault.com/a/178470/135542 , if I send the value j
to it's STDIN with:
echo "j" > /proc/5440/fd/0
I just seem to get j
mixed in the output (after I ran the command a few times):

j
on my keyboard, it reacts correctly.
Asked by Chris Stryczynski
(6603 rep)
Nov 18, 2017, 05:16 PM
Last activity: Jun 12, 2023, 09:14 AM
Last activity: Jun 12, 2023, 09:14 AM