9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: erik quanstrom <quanstro@quanstro.net>
To: 9fans@9fans.net
Subject: Re: [9fans] International Ispell in Plan9
Date: Fri, 12 Apr 2013 08:56:21 -0400	[thread overview]
Message-ID: <56802e952dbdab2949ef6e4fae793332@kw.quanstro.net> (raw)
In-Reply-To: <20130412122153.GA16785@one.invalid.invalid>

> {
> 	echo noscroll
> 	if(~ $#args 0){
> 		cat > /tmp/$pid^'.'aispell0; i = /tmp/$pid^'.'aispell0; winname = `{cat /mnt/acme/$winid/tag | awk '{print $1}'}; for(j in `{cat $i | $home/local/bin/ispell -a $spellflags | awk '/^[&#]/{gsub(/ /,"_"); print}'}){$home/local/bin/acme/spout $i | grep `{echo $j | awk -F_ '{print $2}'} | awk -F: '{OFS=":";$1 = "'$winname'"; print}' >> /tmp/$pid^'.'aispell } ; sort -u /tmp/$pid^'.'aispell > $dir/$id/body; rm -f /tmp/$pid^'.'aispell*
> 	}
> 	if not for(i in $args){
> 		for(j in `{cat $i | $home/local/bin/ispell -a $spellflags | awk '/^[&#]/{gsub(/ /,"_"); print}'}){$home/local/bin/acme/spout $i | grep `{echo $j | awk -F_ '{print $2}'} >> /tmp/$pid^'.'aispell } ; sort -u /tmp/$pid^'.'aispell > $dir/$id/body; rm -f /tmp/$pid^'.'aispell
> 	}
> 	echo clean
> }> $dir/$id/ctl

the rest of the script is nicely formatted.  but it looks
like this bit could use some formatting.  remember, you
get a free newline after { and |.

there is some opportunity to simplify, too.  for example
	cat /mnt/acme/$winid/tag | awk '{print $1}'
is more simply
	sed 's/ .*//g' < /mnt/acme/$winid/tag
i see several places one could replace awk with sed and cat with
redirection.

and i think further simplification is possible by using
{} instead of the temporary file dance.  and i'd imagine
that that's where the bug is.

- erik



  parent reply	other threads:[~2013-04-12 12:56 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-10 22:01 trebol
2013-04-11  6:57 ` Mark van Atten
2013-04-11 17:57 ` Nemo
2013-04-12 12:21   ` trebol
2013-04-12 12:39     ` Francisco J Ballesteros
2013-04-12 12:56     ` erik quanstrom [this message]
2013-04-13  3:36       ` trebol
2013-04-11 12:34 trebol
2013-04-13  6:48 trebol
2013-04-14  2:30 trebol

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=56802e952dbdab2949ef6e4fae793332@kw.quanstro.net \
    --to=quanstro@quanstro.net \
    --cc=9fans@9fans.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).