shell printf - a sensible solution

John Andrew Rosauer johnr at metro.oz
Mon Mar 16 14:12:21 AEST 1987


Below is a shell printf NOT written in C.
People should spend a few minutes thinking to see if something can be
done using available utilities rather than immediately writing
thousands of lines of C. It's wasting someone's money.
###########################################################
if [ $# -lt 1 ]
then
	echo >&2 "Usage: printf format [ arg ...]"
	exit 1
fi
x="\"$1\""
shift
for i
do
	x="$x,\"$i\""
done
awk "BEGIN { printf $x; exit }"



More information about the Comp.sources.unix mailing list