Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!csd4.milw.wisc.edu!bionet!ames!hc!lanl!beta!pt From: pt@beta.lanl.gov (Paul A. Thiessen) Newsgroups: comp.unix.questions Subject: How do I detect output redirection? Keywords: help! Message-ID: <26942@beta.lanl.gov> Date: 23 Jun 89 19:59:53 GMT Distribution: usa Organization: Los Alamos National Laboratory Lines: 33 Okay all you UNIX hackers, answer me this. :-) Say I have a shell command program called 'put': for i do cat $i done I know, it's useless. But if I say 'put * >junk', I get the error message: 'cat: input junk is output' So is there any way that I can detect **before the cat statement** that a given file is the same one that is receiving redirected output? I'd like to have something like: for i do if (($i is not receiving stdout)) then cat $i fi done Thanks for any help! Please respond via e-mail as I don't usually read this newsgroup. - Paul -- ------------------------------------------------------------ PAUL THIESSEN (Summer only: pt@lanl.gov) pthiessen@hmcvax.bitnet ...uunet!jarthur!pthiesse ------------------------------------------------------------