xref: /original-bsd/usr.bin/shar/shar.sh (revision db9e1aef)
1#!/bin/sh -
2#
3# Copyright (c) 1990 The Regents of the University of California.
4# All rights reserved.
5#
6# %sccs.include.redist.sh%
7#
8#	@(#)shar.sh	5.2 (Berkeley) 05/23/90
9#
10
11if [ $# -eq 0 ]; then
12	echo 'usage: shar file ...'
13	exit 1
14fi
15
16cat << EOF
17# This is a shell archive.  Save it in a file, remove anything before
18# this line, and then unpack it by entering "sh file".  Note, it may
19# create directories; files and directories will be owned by you and
20# have default permissions.
21#
22# This archive contains:
23#
24EOF
25
26for i
27do
28	echo "#	$i"
29done
30
31echo "#"
32
33for i
34do
35	if [ -d $i ]; then
36		echo "echo c - $i"
37		echo "mkdir $i > /dev/null 2>&1"
38	else
39		echo "echo x - $i"
40		echo "sed 's/^X//' >$i << 'END-of-$i'"
41		sed 's/^/X/' $i
42		echo "END-of-$i"
43	fi
44done
45echo exit
46echo ""
47
48exit 0
49