Reputation: 31590
Using bash, is it possibile to send the equivalent of a space bar stroke to a process? If so, how can that be done?
Edit to clarify a bit what I want to achieve: let's say I've got an mplayer process running and I want to pause the execution of the current song, how would I achieve this?
Upvotes: 1
Views: 1696
Reputation: 30522
You can send a signal to a process using kill command. Try man kill
for more info.
Upvotes: 0
Reputation: 73752
You can direct standard I/O to it. If you are using Bash, then you probably have other GNU tools. GNU Coreutils has an echo
command that can output pretty much anything. For example:
$ echo -n ' ' | some_command
However if you need an actual TTY (terminal) and you have more sophisticated requirements, look into expect, which can do nearly anything a human can (except think).
Upvotes: 4