From mboxrd@z Thu Jan 1 00:00:00 1970 To: 9fans@cse.psu.edu Subject: Re: [9fans] finding acme window id from shell script? From: rog@vitanuova.com MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Message-Id: <20020403145516.4284F199D5@mail.cse.psu.edu> Date: Wed, 3 Apr 2002 15:58:06 +0100 Topicbox-Message-UUID: 7248eb86-eaca-11e9-9e20-41e7f4b1d025 > id=`{grep $% /mnt/acme/index | awk '{print $1}'} , or so that's not entirely accurate as it's quite possible to have have different acme windows with the same tag file, either deliberately (via Zerox) or accidentally (by typing). while we're on the subject of shell scripts for acme, here's a little shell script i wrote years ago to show me what changes i'd made to a file within acme. use like: afdiff somefile.c it's a testament to the resilience of the file-style interface that it has remained unchanged (and working) throughout all the changes to acme (e.g. alef->C) that have taken place in the meantime. the modification date on the script is March 1999. #!/bin/rc # afdiff: show differences between the file contents as held in # acme's internal buffers and the file as actually held in the filesystem. if (! test -f /mnt/acme/index) { echo 'not inside acme' >[1=2]; exit fail } if (! ~ $#* 1 2) { echo 'usage: afdiff acmefile [file]' >[1=2] exit usage } pat=`{echo $1 | sed 's/[.*()[|+]/\\&/g'} poss=`{awk '{print $1, $6}' < /mnt/acme/index | grep ' .*'^$pat^'$'} if (! ~ $#poss 2) { { if (~ $#poss 0) { echo no matching acme files exit nomatch } echo 'afdiff: ambiguous name; possible matches are:' *=$poss while (! ~ $#* 0 1) {echo $2; shift 2} } >[1=2] } f2=/mnt/acme/^$poss(1)^/body if (~ $#* 2) f1=$*(2) if not f1=$poss(2) exec diff $f1 $f2