Re: access the stdin of the parent process in a pipeline
From:
Mike Jonkmans
Subject:
Re: access the stdin of the parent process in a pipeline
Date:
Wed, 25 Mar 2020 20:28:47 +0100
Apart from the redirection as part of a function declaration,
you can also use compund commands, as Chet already mentioned.
One hardly see these constructs in system scripts.
Though they are properly documented in the bash manual.
Sometimes a 'subshell function' may be useful :
f() ( ... )
E.g. when 'cd's are done in the body, the working directory gets restored.
If you want to abbreviate a long construct, these can be used:
f() [[ ... ]]
f() (( ... ))
And even:
f() for ... done
f() if ... fi
etc.
Regards, Mike