From rpm's man page:
--pipe CMD Pipes the output of rpm to the command CMD.
Why was this added? Why would you use it instead piping via the shell itself?
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It only takes a minute to sign up.Sign up to join this community
That option would not be useful when
rpm is called from a shell.
But when called from some other program it would simplify passing non-static arguments to
rpm if those arguments are constructed from some form of user input (provided the calling program is written in a language that does not forcefully call a shell to execute other programs anyway):
sh -c ´rpm Argument1 Argument2 ...´ | CMD, it needs an additional level of quoting around arguments to prevent them from being split into words or interpreted by the shell if those arguments could contain spaces or shell metacharacters:
rpmis user input to the calling program, it could possibly be
Tom and Alice´s dogand the programmer would have to translate that to
Tom\ and\ Alice\´s\ dogwhen building the argument list for the shell. (And any arguments to
CMDwould have to be quoted the same way.)
--pipeoption, the calling program needs none of these.
CMDwould have to be quoted like before because CMD is interpreted by a shell which is called from
CMDis a single word from a single argument to