From: Christian Grothaus <cgrothau@mitch.hrz.uni-bielefeld.de>
To: 9fans@cse.psu.edu
Subject: Re: [9fans] rewriting scripts for rc
Date: Wed, 21 Aug 2002 12:20:57 +0000 [thread overview]
Message-ID: <3d638508_2@news.uni-bielefeld.de> (raw)
In-Reply-To: <02082019184300.00575@localhost.localdomain>
Andrey S. Kukhar <plan9@kp.km.ua> wrote:
> [-- text/plain, encoding 8bit, 4 lines --]
> folks, can you help me with rewriting a few Bourne shell scripts for rc
> thanks,
> -ask
> [-- application/x-shellscript, encoding base64, 22 lines, name: nom --]
> [-- application/x-shellscript, encoding base64, 9 lines, name: cal_today --]
Hello Andrey,
you probably got already some solutions. Here are mine
(not testet intensively).
Hope they work!
Christian
--- cal_today -------------------------8<--------------------------------
#!/bin/rc
switch ($#*) {
case 0;
*=`{date}
cal | sed -e 's/^/ /' -e 's/ '^$3^'$/>'^$3^'</' \
-e 's/ '^$3^' />'^$3^'</'
case *;
cal $*
}
--- nom -------------------------------->8-------------------------------
#!/bin/rc
temp=/tmp/NOM$pid
stat=1
fn sigexit sigint sighup sigterm {
rm -f $temp
exit $stat
}
switch ($*) {
case '';
echo Usage: `{basename $0} pattern >[1=2]
exit
case */*;
echo `{basename $0} 'quitting: I can''t handle /s.' >[1=2]
exit
}
echo $* | tr ' ' '\012' | sort > $temp
ls | comm -23 - $temp
stat=0
--- nom (without using a temporary file) --------------------------------
#!/bin/rc
switch ($*) {
case '';
echo Usage: `{basename $0} pattern >[1=2]
exit
case */*;
echo `{basename $0} 'quitting: I can''t handle /s.' >[1=2]
exit
}
comm -23 <{ls} <{echo $* | tr ' ' '\012' | sort}
--------------------------------------->8--------------------------------
prev parent reply other threads:[~2002-08-21 12:20 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-08-20 23:18 Andrey S. Kukhar
2002-08-21 12:20 ` Christian Grothaus [this message]
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=3d638508_2@news.uni-bielefeld.de \
--to=cgrothau@mitch.hrz.uni-bielefeld.de \
--cc=9fans@cse.psu.edu \
/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).