silly silly script

| July 15th, 2009

I can be very lazy i guess, while reading beginning perl, available here http://www.perl.org/books/beginning-perl/   i got tired of opening a new file and typing in /usr/bin/perl and then the name, and needing it to chmod +x everytime , so i write a script to do the same for me,

so all i do is type newperl month and a file with month.plx and the necessary shebang and filename and author name is created . ofcourse i dropped it in /usr/bin for it to work anywhere. below is the script. just change the author value to your name

#!/bin/sh
#newperl.sh
author=deadwait
if [ -z $1 ]
then
echo “You have not mentioned a filename”
exit $E_NOARGS
fi
echo “building file $1.plx”
echo “#!/usr/bin/perl” > $PWD/$1.plx
echo “#$1.plx”>>$PWD/$1.plx
echo “#Author - $author” >> $PWD/$1.plx
chmod +x $1.plx
echo “Done “

Leave a Reply