1#! /bin/bash
2#
3# center - center a group of lines
4#
5# tabs in the lines might cause this to look a little bit off
6#
7#
8
9width=${COLUMNS:-80}
10
11if [[ $# == 0 ]]
12then
13	set -- /dev/stdin
14fi
15
16for file
17do
18	while read -r
19	do
20		printf "%*s\n" $(( (width+${#REPLY})/2 )) "$REPLY"
21	done < $file
22done
23
24exit 0
25