#!__SHELL__
################################################################################
# $Id: mksh.def,v 1.1 2010/09/26 15:13:18 nakamkaz Exp $
# mksh command
# Description: poor shell script template generator
# Usage: mksh newfile.sh [ interpreter ]
# http://sourceforge.jp/projects/aalaya

if [ -z $1 ]
then
echo 'Please specify new file name.'
echo 'Usage: mksh  newfile.sh [ interpreter ]'
exit 0
fi

which $2
if [ $? == 0 ]
then
INTPRT=`which $2`
else
INTPRT=$SHELL
fi

if [ ! -e $1 ]
then
cat << EOT >> $1
#!$INTPRT
################################################################################
# \$Id\$
# $1 command
# Description:
# Usage:
# Author: 

EOT
echo MKSH made $1.
chmod u+x $1
ls -l $1
else
  echo The file already exists! 1<&2
exit 1
fi