
# HPUX_ID: @(#)29.1   86/07/04
#          @(#)unshar.sh	29.1      86/06/24

# Unpack shell archive (series of here-documents) by piping the relevant
# parts to sh(1).

# Usage: <script> [files...]

# Reads stdin by default.  Basically, all it does is ignore lines before the
# first "#" or ":" comment starting in the first column.

# hpfcla:net.sources / telesoft!pilotti /  5:46 am  Aug 29, 1985
# Cleaned up by ajs, 860527

if [ $# = 0 ]			# no args given.
then
    set -- \-			# use standard input.
fi

for file in "$@"
do
    if [ "x$file" = x- ]
    then
        echo "Unshar'ing standard input..."
	sed -n '/^[#:]/,$ p' | sh	# sed doesn't understand "-".
    else
        echo "Unshar'ing $file..."
	sed -n '/^[#:]/,$ p' "$file" | sh
    fi
done
