v19i080: unsh - script to un-sh shar files, Part01/01
Luke Mewburn
s902113 at minyos.xx.rmit.OZ.AU
Fri May 17 12:53:44 AEST 1991
Submitted-by: Luke Mewburn <s902113 at minyos.xx.rmit.OZ.AU>
Posting-number: Volume 19, Issue 80
Archive-name: unsh/part01
I submit here a (modified) script which removes the chore of
using an editor to remove the stuff before each #!/bin/sh line, and
sh-ing the file. It works very well for multiple files (eg. zsh-01,
zsh-02, etc).
Note that to use with multiple files, you must supply the name-part
which is common to all the files (eg. using above example, 'zsh-0')
Finally, the file _MUST_ be in 'normal' sh format, so a
line with '#!/bin/sh' must exist...
Also, (unlike ush1.0), the name '#! /bin/sh' (with a space) is valid.
---------------
History:
1.1: (1-may-91)
o Fixed bug where a space between the '!' and the '/' would not work.
o Fixed bug where multiple occurances of '#!/bin/sh' would not work.
1.0: (27-april-91)
o First release (funny that!)
o Saw & modified idea by Chris Hillery.
# --- cut this line & above ---------
#!/bin/sh
# ush V1.1
#
# A file which 'sh''s multi-part files from mail/news, without werjing
# on the mail header crap.
#
# By Luke Mewburn (s902113 at minyos.xx.rmit.oz.au), after an similar file
# which only worked for a music module mailing-list.
# Thanx to: Chris Hillery (ceej at rpi.edu) & Steve Wahl [inpiration!]
# Use as you wish, please keep intact
#
# Usage: ush <msgname>
#
# where <msgname> is the first part of the names of the saved mail messages
# or a single file.
#
for file in $1*
do
echo File: $file
tail +`sed 128q $file |grep -n '^#! *\/bin\/sh' |sed '1s/:#! *\/bin\/sh//'` \
$file |sh
done
# --- cut this line & below --- --- cut this line & below ---
--
------------------------------------------------------------------------
| Luke Mewburn (Zak) | This side for rent... |
| s902113 at minyos.xx.rmit.oz.au | |
exit 0 # Just in case...
--
Kent Landfield INTERNET: kent at sparky.IMD.Sterling.COM
Sterling Software, IMD UUCP: uunet!sparky!kent
Phone: (402) 291-8300 FAX: (402) 291-4362
Please send comp.sources.misc-related mail to kent at uunet.uu.net.
More information about the Comp.sources.misc
mailing list