Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!uunet!sparky!kent From: s902113@minyos.xx.rmit.OZ.AU (Luke Mewburn) Newsgroups: comp.sources.misc Subject: v19i080: unsh - script to un-sh shar files, Part01/01 Summary: A script to un-'sh' files Keywords: SH Message-ID: <1991May17.025344.28072@sparky.IMD.Sterling.COM> Date: 17 May 91 02:53:44 GMT Sender: kent@sparky.IMD.Sterling.COM (Kent Landfield) Organization: RMIT Computer Centre, Melbourne Australia. Lines: 67 Approved: kent@sparky.imd.sterling.com X-Md4-Signature: 33f114b362580ff1e89d6d77973e274a Submitted-by: Luke Mewburn 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@minyos.xx.rmit.oz.au), after an similar file # which only worked for a music module mailing-list. # Thanx to: Chris Hillery (ceej@rpi.edu) & Steve Wahl [inpiration!] # Use as you wish, please keep intact # # Usage: ush # # where 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@minyos.xx.rmit.oz.au | | exit 0 # Just in case... -- Kent Landfield INTERNET: kent@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@uunet.uu.net.