posix-dergutils/primitives/linepipedo

26 lines
536 B
Bash
Executable File

#!/bin/sh
# Run arguments as a command, piping in data from stdin.
# Command run defaults to 'cat'.
# Requires: <program> <package (Devuan)>
# echo coreutils
# cat coreutils
if [ -z $USAGE_LOCK ] ; then
NAME="$(filename $0)"
USAGE="Usage: $NAME [command, args...]"
if usage "$1" "$USAGE" ; then exit ; fi
export USAGE_LOCK=1
fi
ARGS="$@"
if [ "$ARGS" = "" ] ; then
set -- "cat"
fi
ARG=0
until [ "$ARG" = "" ] ; do
read ARG
if [ "$ARG" != "" ] ; then echo "${ARG}" | "$@" ; fi
done