in reply to Re: How do I Determine if my script is being piped to?
in thread How do I Determine if my script is being piped to?

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.

Replies are listed 'Best First'.
Re^3: How do I Determine if my script is being piped to?
by BrowserUk (Patriarch) on Nov 21, 2013 at 09:58 UTC
    There are cases where -t does not suffice, are also cases where -p does not suffice? edge cases?

    Search the stat() docs for S_IFIFO.


    With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.