Bundle files in Unix

by

Use this script to bundle files that will automagically unbundle when the file is executed:

#!/bin/sh
## Bundle --  put listed files into a bundle on stdout which sh will unbundle
# From "The UNIX Programming Environment," by Brian Kernighan and
#   Rob Pike, Prentice Hall, 1984.
echo "# To unbundle, sh this file"
for i
do
  echo "echo $i 1>&2"
  echo "cat >$i <<'End of $i'"
  cat $i
  echo "End of $i"
done
Advertisements

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


%d bloggers like this: