Plan 9 from Bell Labs’s /usr/web/sources/contrib/anothy/bin/rc/sparkline

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


#!/bin/rc

rfork e

if (~ $#* 0) {
	echo 'usage: '$0' n [n...]' >[1=2]
	exit usage
}

min=$1
max=$1

for (i in $*) {
	if (test $i -lt $min)
		min=$i
	if (test $i -gt $max)
		max=$i
}

for (i in $*) {
	q=`{hoc -e 'int(('$i' - '$min') / (('$max' - '$min') / 8))'}
	echo -n $q |  tr 012345678 ▁▂▃▄▅▆▇██
}

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to [email protected].