The script couldn't work on Debian anyway, because it relies on the behaviour
of the OpenBSD versions of apm, iostat and typeset.

I have sent the attached patch, which fixes all the bashisms AFAICT,
upstream, in the hope it will be included in the next upstream release.

That said, I will probably have to rewrite most of the script to make it
work on Debian, or simply drop it from the examples.

-- 
Andrea Bolognani <e...@kiyuko.org>
Resistance is futile, you will be garbage collected.
--- baraction.sh.orig	2009-05-30 20:35:24.000000000 +0200
+++ baraction.sh	2009-05-30 20:47:17.000000000 +0200
@@ -1,5 +1,8 @@
 #!/bin/sh
 
+APM=/usr/sbin/apm
+IOSTAT=/usr/sbin/iostat
+
 print_date() {
 	# The date is printed to the status bar by default.
 	# To print the date through this script, set clock_enabled to 0
@@ -72,16 +75,16 @@
 while :; do
 	# instead of sleeping, use iostat as the update timer.
 	# cache the output of apm(8), no need to call that every second.
-	/usr/sbin/iostat -C -c 3600 |&	# wish infinity was an option
+	$IOSTAT -C -c 3600 2>&1 |	# wish infinity was an option
 	APM_DATA=""
 	I=0
-	while read -p; do
-		if [ $(( ${I} % 1 )) -eq 0 ]; then
-			APM_DATA=`/usr/sbin/apm -alb`
+	while read IOSTAT_DATA; do
+		if [ $(( ${I} % 10 )) -eq 0 ]; then
+			APM_DATA=`$APM -alb`
 		fi
 		if [ $I -gt 2 ]; then
 			# print_date
-			print_cpu $REPLY
+			print_cpu $IOSTAT_DATA
 			print_apm $APM_DATA
 			echo ""
 		fi

Attachment: pgp0HH1ONfaZs.pgp
Description: PGP signature

Reply via email to