bash/shell progress function

gistfile1.sh

process_progress() {
	[ -z $1 ] && exit 0
	PROGRESS=(".      " " ..    " "  ...  " "    .. " "      ." "    .. " "  ...  " " ..    ")
	COUNTER=0
	echo -n "$2 "
	while `ps -p $1 > /dev/null`; do
		[ $COUNTER -eq 8 ] && COUNTER=0
		echo -n "${PROGRESS[$COUNTER]}"
		echo -n " Running "
		sleep 0.5
		printf "bbbbbbbbbbbbbbbb"
		COUNTER=$(( $COUNTER + 1 ))
	done
	echo '...... Complete'
}
No comments yet.

Leave a Reply