#!/bin/bash

%(sh_comment template "header_gpl")

IN=/dev/stdin
OUT=/dev/stdout
LOG=/dev/null

USAGE="[OPTION]...

  -h, -?   print this message
  -l path  set the log path     [ $LOG ]
  -i path  set the input path   [ $IN ]
  -o path  set the output path  [ $OUT ]"

while :;
	do case "$1" in
		-h | "-?" )	
			echo -e usage: ${0##*/} "$USAGE" >&2
			exit 1 ;;
		-i )
			IN=$2
			shift ;;
		-o )
			OUT=$2
			shift ;;
		-l )
			LOG=$2
			shift ;;
		-?* )
			echo "${0##*/}: unrecognised option: $1" >&2
			exit 1 ;;
		* )
			break ;;
	esac
	shift
done

if [ ! -f $IN ]; then
        echo "${0##*/}: $IN does not exist" >&2
	exit 1
fi

cat $IN > $OUT
echo $IN > $LOG
