Sophie

Sophie

distrib > Fedora > 16 > i386 > by-pkgid > 48c9278b808afd9b11daa8f5a3d2ffbe > files > 180

bash-doc-4.2.37-1.fc16.i686.rpm

#! /bin/bash
#
# center - center a group of lines
#
# tabs in the lines might cause this to look a little bit off
#
#

width=${COLUMNS:-80}

if [[ $# == 0 ]]
then
	set -- /dev/stdin
fi

for file
do
	while read -r
	do
		printf "%*s\n" $(( (width+${#REPLY})/2 )) "$REPLY"
	done < $file
done

exit 0