This little script is a great example of how something simple in UNIX can do a lot. It skips past the mail header and comments that come before some, then feeds the archive to a shell. You can use it while you're reading a message with most UNIX :
save | unshar
or give it the name of an archive file on its command line:
and so on. Here's a version of the script:
#! /bin/sh # IGNORE LINES BEFORE FIRST "#" COMMENT STARTING IN FIRST COLUMN: sed -n '/^#/,$p' $1 | sh
The script reads from its standard input or a single file.
It skips all lines until the comment (
#) that starts most
shell archives; the rest of the lines are piped to the shell.
It doesn't read from multiple files; that would add another couple
of lines for a loop - and make the script too long!
In the last few years,
have come out.
They protect against "Trojan horses" buried in shar files and let
systems without a Bourne shell (like DOS) unpack shell archives.
This basic script still does a fine job though.
[It also gives one more demonstration of why at least basic knowledge
is so important to would-be power users.
It's an incredibly handy
utility. -TOR ]