9front - general discussion about 9front
 help / color / mirror / Atom feed
* delkey(1)
@ 2015-09-29 22:21 Julius Schmidt
  2015-09-29 23:35 ` [9front] delkey(1) arisawa
  0 siblings, 1 reply; 4+ messages in thread
From: Julius Schmidt @ 2015-09-29 22:21 UTC (permalink / raw)
  To: 9front

delkey(1) strikes me as stupid.
it should be more like

% delkey
echo 'delkey proto=hj user=dicks' >/mnt/factotum/ctl
echo 'delkey proto=p9sk1 user=glenda' > /mnt/factotum/ctl
etc

instead of the silly yes/no prompting.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [9front] delkey(1)
  2015-09-29 22:21 delkey(1) Julius Schmidt
@ 2015-09-29 23:35 ` arisawa
  0 siblings, 0 replies; 4+ messages in thread
From: arisawa @ 2015-09-29 23:35 UTC (permalink / raw)
  To: 9front

Hello

> 2015/09/30 7:21、Julius Schmidt <aiju@phicode.de> のメール:
> 
> delkey(1) strikes me as stupid.
> it should be more like
> 
> % delkey
> echo 'delkey proto=hj user=dicks' >/mnt/factotum/ctl
> echo 'delkey proto=p9sk1 user=glenda' > /mnt/factotum/ctl
> etc
> 
> instead of the silly yes/no prompting.

I love the script below.

hebe% cat /usr/local/bin/rc/fact
#!/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
	}
hebe% 



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [9front] delkey(1)
  2015-10-07  0:47 sl
@ 2015-10-23 10:16 ` Ethan Grammatikidis
  0 siblings, 0 replies; 4+ messages in thread
From: Ethan Grammatikidis @ 2015-10-23 10:16 UTC (permalink / raw)
  To: 9front



On Wed, Oct 7, 2015, at 01:47 AM, sl@9front.org wrote:
> > delkey(1) strikes me as stupid.
> > it should be more like
> > 
> > % delkey
> > echo 'delkey proto=hj user=dicks' >/mnt/factotum/ctl
> > echo 'delkey proto=p9sk1 user=glenda' > /mnt/factotum/ctl
> > etc
> > 
> > instead of the silly yes/no prompting.
> 
> I agree with this.
> 
> sl

oh, yes please! i don't know why i didn't reply to this before; i hate programs which present question after question.

-- 
Wir mussen wissen, wir werden wissen.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [9front] delkey(1)
@ 2015-10-07  0:47 sl
  2015-10-23 10:16 ` Ethan Grammatikidis
  0 siblings, 1 reply; 4+ messages in thread
From: sl @ 2015-10-07  0:47 UTC (permalink / raw)
  To: 9front

> delkey(1) strikes me as stupid.
> it should be more like
> 
> % delkey
> echo 'delkey proto=hj user=dicks' >/mnt/factotum/ctl
> echo 'delkey proto=p9sk1 user=glenda' > /mnt/factotum/ctl
> etc
> 
> instead of the silly yes/no prompting.

I agree with this.

sl


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-10-23 10:16 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-09-29 22:21 delkey(1) Julius Schmidt
2015-09-29 23:35 ` [9front] delkey(1) arisawa
2015-10-07  0:47 sl
2015-10-23 10:16 ` Ethan Grammatikidis

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).