I have the following:
if [[ "${STDOUT}" == '/dev/stdout' ]]; then
"${mysql_cmd[@]}" <"${STDIN}" >"${STDOUT}"
else
"${mysql_cmd[@]}" <"${STDIN}" |
sed -e 's|[[:<:]]NULL[[:>:]]|\N|g' >"${STDOUT}"
fi
I’d like to make it into a one-liner similar to "${mysql_cmd[@]}" <"${STDIN}" | "${transformer_cmd[@]}" >"${STDOUT}"
.
When transformer_cmd
is a “null object” (ie not the sed
command), mysql
must continue to be interactive. I’ve tried cat
as transformer_cmd
and that failed this requirement.
Is this possible? If so, how?
I’d rather avoid doing something like "${mysql_cmd[@]}" <"${STDIN}" "${transformer_cmd}" >"${STDOUT}"
such that transformer_cmd
includes the |
but will do so if there’s no other way.