Thursday, May 2, 2024
 Popular · Latest · Hot · Upcoming
1
rated 0 times [  1] [ 0]  / answers: 1 / hits: 644  / 3 Years ago, sun, august 1, 2021, 8:24:54

Here's what I have:



A script that records sound and exits when pushing ctrl+c



arecord -D plughw:0,0 -f cd -t wav -d 0 -q -r 16000 > file


This will record and record until I push ctrl+c



I want to simulate the ctrl+c action, by pushing any key (preferably one keystroke)


More From » automation

 Answers
1

You can use stty in a subshell and change the setting for ctrl-c to whatever. In my example I changed it to x. After the subshell is ended or interrupted by x the setting will be restored to ^c (ctrl-c).



user@host:~# (stty intr x && arecord -D plughw:0,0 -f cd -t wav -d 0 -q -r 16000 > file); stty intr ^c


Even if you kill the process via killall acroread the setting will be restored.


[#28434] Tuesday, August 3, 2021, 3 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
elecerna

Total Points: 140
Total Questions: 121
Total Answers: 107

Location: Northern Ireland
Member since Sun, Nov 21, 2021
3 Years ago
;