Plan 9 from Bell Labs’s /usr/web/sources/contrib/nemo/rc/bin/env/terms

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


#!/bin/rc

rfork e
servers=no
if (~ $1 -k){
	terms=`{env/terms}
	cd /lib/ndb/vol
	for (t in $terms){
		addr=`{grep -l '/dev/kbd.*sys='^$t *!*!*|sed 1q}
		if (! ~ $#addr 0)
			echo $t^'='^$addr
	}
	exit ''
}
if (~ $1 -m){
	terms=`{env/terms}
	cd /lib/ndb/vol
	for (t in $terms){
		addr=`{grep -l '/dev/mouse.*sys='^$t *!*!*|sed 1q}
		if (! ~ $#addr 0)
			echo $t^'='^$addr
	}
	exit ''
}
if (~ $1 -a){
	servers=yes
	shift
}
if (~ $1 -p){
	# back compat
	echo env/terms called with -p flag. remove call. >[1=2]
	exit ''
}

hosts=`{grep -l $user /what/*/owner | sed 's|/what/([a-z0-9]*)/owner|\1|' |sort|uniq}
for (h in $hosts){
	if (~ $servers yes || ! ~ `{cat /what/$h/role} server){
		echo -n $h
		if (~ $1 -r) {
			echo '	'^`{cat /what/$h/role}
		}
		if not
			echo
	}
}
exit ''

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to webmaster@9p.io.