Hi,
I have a script, named "script1", which reads from STDIN:
print STDERR "Enter a character:";
open STDIN, "/dev/tty" or warn "couldn't open /dev/tty $!\n";
my($c);
$c = getc(STDIN);
There is a unix shell script, named "script2", containing:
script1
Without changing the first script, is there a way to read a file for the input. I have tried using:
script1 < /dir/input_filename
also tried:
script1 &0< /dir/input_filename
and tried:
script1 << EOF
x
EOF
but it does not work. Is there a way to set STDIN to obtain input from a file and then set it back to accept input from the keyboard?
Thanks,
JL
I have a script, named "script1", which reads from STDIN:
print STDERR "Enter a character:";
open STDIN, "/dev/tty" or warn "couldn't open /dev/tty $!\n";
my($c);
$c = getc(STDIN);
There is a unix shell script, named "script2", containing:
script1
Without changing the first script, is there a way to read a file for the input. I have tried using:
script1 < /dir/input_filename
also tried:
script1 &0< /dir/input_filename
and tried:
script1 << EOF
x
EOF
but it does not work. Is there a way to set STDIN to obtain input from a file and then set it back to accept input from the keyboard?
Thanks,
JL