In my script, I would like to simulate the fact that someone presses on the "x" key on the keyboard and then presses Return.
I got some info from web, but still confused
If anyone knows how to do that or if it is even possible to do it. Cheers !
I got some info from web, but still confused
Code:
#!/usr/bin/perl -w
require 'sys/ioctl.ph';
die "no TIOCSTI" unless defined &TIOCSTI;
sub jam {
local $SIG{TTOU} = "IGNORE"; # "Stopped for tty output" local *TTY; # make local filehandle open(TTY, ">/dev/tty") or die "no tty: $!"; for (split(//, $_[0])) { ioctl(TTY, &TIOCSTI, $_) or die "bad TIOCSTI: $!"; }
close(TTY);}
jam("@ARGV\n");
If anyone knows how to do that or if it is even possible to do it. Cheers !