[techtalk] How a script is called

Conor Daly conor.daly at oceanfree.net
Wed Aug 16 19:48:48 EST 2000


On Wed, Aug 16, 2000 at 08:15:13AM +0100 or so it is rumoured hereabouts,
 Conor Daly thought...
> Anyone know how a bash / csh script can tell if it was called in a pipeline or
> directly from the commandline?  I've a script that I want to run either by
> catting a file through a pipe or by invoking from the commandline with the
> file as an arg and I need the script to behave slightly differently in either
> case.
> 

Nice answers everyone but, alas, there is an implicit assumption that there's
only one arg or none involved.  I'm accepting up to three args in any order at
present and have no control over how the script is called in the case of a
pipe.  

Can I pass Kevin's "files=-" as an arg to a subsequent script or do I need to 

cat | secondscript

to have sdtin pass through to the second script?

Thanks,
-- 
Conor Daly <conor.daly at oceanfree.net>

Domestic Sysadmin :-)





More information about the Techtalk mailing list