#!/bin/rc # # fact is a tool to manage factotum. # rfork e usage='usage: fact [-adl]' fn addkey { echo adding to $1 cat $1 echo '# put data and RETURN' awk '/^$/{exit} /.+/{print}' | read -m >/$1 # awk '/^$/{exit} /.+/{print}' >/$1 } fn delkey { echo deleting from $1 #sed s/key/delkey/g < $1 sed 's/key/delkey/g;s/!.*?//g' < $1 echo '# send and RETURN' awk '/^$/{exit} /.+/{print}' | read -m > $1 # awk '/^$/{exit} /.+/{print}' > $1 } ctl=() f=(/mnt /mnt/term/mnt)^/factotum/ctl if(test -w $f(2)) ctl=$f(2) if(test -w $f(1)) ctl=$f(1) while(~ $1 -*){ switch($1){ case -d delkey $ctl exit case -d1 delkey $f(1) exit case -d2 delkey $f(2) exit case -a addkey $ctl exit case -a1 addkey $f(1) exit case -a2 addkey $f(2) exit case -l f=(/mnt /mnt/term/mnt)^/factotum for (x in $f) if(test -e $x) ls -l $x exit case -* echo $usage exit usage } shift } for (x in $f) if(test -w $x){ ls -l $x cat $x }