ooh thanks BrowserUk never eard of -p operator, or may be forgotten it long time ago.
Due to my ignorance i wonder if -p -t are one the opposite of the other: in the docs -p is just mentioned and, albeit self explanatory, not described. There are cases where -t does not suffice, are also cases where -p does not suffice? edge cases?
My test:
perl -e " print -t STDIN ? qq(STDIN has tty) : qq(NO tty associated);p
+rint ' - '; print -p STDIN ? qq(STDIN is a pipe or a named pipe) : qq
+(NOT a pipe)"
#out
#STDIN has tty - NOT a pipe
hostname | perl -e " print -t STDIN ? qq(STDIN has tty) : qq(NO tty as
+sociated);print ' - '; print -p STDIN ? qq(STDIN is a pipe or a named
+ pipe) : qq(NOT a pipe)"
#out
#NO tty associated - STDIN is a pipe or anamed pipe
thanks L*
There are no rules, there are no thumbs..
Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.
|