Schuyler Bishop wrote:

[snip]


I've googled this pretty extensively and searched the archives equally vigorously and came up with the 'if (-f)', but neither that nor 'if (-t) seem to ever return a 1 so that the loop is executed.


The file test operators need a file handle. The default is '_' which is the last file test. Not sure what happens if you've never performed one yet...

$ uname -a
SunOS angel 5.8 Generic_108528-22 sun4u sparc SUNW,Sun-Blade-100
$ echo hello | perl -e "-f STDIN && print qq(file\n); -t STDIN && print 
qq(terminal\n);"
$ perl -e "-f STDIN && print qq(file\n); -t STDIN && print qq(terminal\n);"
terminal
$ perl -e "-f STDIN && print qq(file\n); -t STDIN && print qq(terminal\n);" < 
/etc/passwd
file
$ perl -e "-f STDIN && print qq(file\n); -t STDIN && print qq(terminal\n);" < /dev/null
$

hth,
rgr

_______________________________________________
Perl-Unix-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to