The script would need to check if the input file is supplied as an argument. If it is not, then assume that input is piped. The first command in the script that uses stdin must then process the pipe, e.g...
[tt]
if [[ ! $File ]]
then
File=/tmp/file$$
cat > $File #---this is being piped into
fi[/tt]
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.