From: "Andrey S. Kukhar" <plan9@kp.km.ua>
To: 9fans@cse.psu.edu
Subject: [9fans] rewriting scripts for rc
Date: Tue, 20 Aug 2002 19:18:43 -0400 [thread overview]
Message-ID: <02082019184300.00575@localhost.localdomain> (raw)
[-- Attachment #1: Type: text/plain, Size: 88 bytes --]
folks, can you help me with rewriting a few Bourne shell scripts for rc
thanks,
-ask
[-- Attachment #2.1: Type: text/plain, Size: 338 bytes --]
The following attachment had content that we can't
prove to be harmless. To avoid possible automatic
execution, we changed the content headers.
The original header was:
Content-Type: application/x-shellscript;
charset="koi8-r";
name="nom"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="nom"
[-- Attachment #2.2: nom.suspect --]
[-- Type: application/octet-stream, Size: 1190 bytes --]
#! /bin/sh
#
### nom - return names of non-matching files from current directory
### Usage: nom files (example: lpr `nom *.ms`)
##
## nom TAKES FILENAMES (USUALLY, EXPANDED BY THE SHELL) FROM ITS COMMANDLINE.
## IT OUTPUTS ALL FILENAMES IN THE CURRENT DIRECTORY THAT *DON'T* MATCH.
## NOTE: nom DOESN'T KNOW ABOUT FILES WHOSE NAMES BEGIN WITH "."
##
## EXAMPLES:
## TO GET THE NAMES OF ALL FILES THAT *DON'T* END WITH ".ms":
## % nom *.ms
## TO EDIT ALL FILES WHOSE NAMES DON'T HAVE ANY LOWER-CASE LETTERS:
## % vi `nom *[a-z]*`
## TO COPY ALL FILES TO A DIRECTORY NAMED Backup (EXCEPT Backup ITSELF):
## % cp `nom Backup` Backup
temp=/tmp/NOM$$
stat=1 # ERROR EXIT STATUS (SET TO 0 BEFORE NORMAL EXIT)
trap 'rm -f $temp; exit $stat' 0 1 2 15
# MUST HAVE AT LEAST ONE ARGUMENT, AND ALL HAVE TO BE IN CURRENT DIRECTORY:
case "$*" in
"") echo Usage: `basename $0` pattern 1>&2; exit ;;
*/*) echo "`basename $0` quitting: I can't handle '/'s." 1>&2; exit ;;
esac
# GET FILENAMES WE DON'T WANT TO MATCH; REPLACE BLANKS WITH NEWLINES:
echo "$*" | tr ' ' '\012' | sort > $temp
# COMPARE TO CURRENT DIRECTORY (-1 = ONE NAME PER LINE); OUTPUT NAMES WE WANT:
ls -1 | comm -23 - $temp
stat=0
[-- Attachment #3.1: Type: text/plain, Size: 350 bytes --]
The following attachment had content that we can't
prove to be harmless. To avoid possible automatic
execution, we changed the content headers.
The original header was:
Content-Type: application/x-shellscript;
charset="koi8-r";
name="cal_today"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="cal_today"
[-- Attachment #3.2: cal_today.suspect --]
[-- Type: application/octet-stream, Size: 413 bytes --]
#!/bin/sh
#
# cal_today - if user doesn't give an argument, put > < around today's
# date on this month's calendar
case $# in
0) set x `date` # Get the current day of the month into $4
/usr/bin/cal |
# Put > < around $4 (shell expands $4 inside the doublequotes)
sed -e 's/^/ /' -e "s/ $4$/>$4</" -e "s/ $4 />$4</"
;;
# If arguments are given, just run the normal cal
*) /usr/bin/cal "$@" ;;
esac
next reply other threads:[~2002-08-20 23:18 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-08-20 23:18 Andrey S. Kukhar [this message]
2002-08-21 12:20 ` Christian Grothaus
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=02082019184300.00575@localhost.localdomain \
--to=plan9@kp.km.ua \
--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).