Saturday, June 14, 2008

Shell-script to add comments and html tags in php files.

I am sometimes required to write PHP scripts and I find typing tags and comments quite boring. Look what I have done. I have written a fully automated script that will make you job very easy and you can easily place tags and comments into your php scripts.

Just go through it and let me know if you happen to come across any bug in it. eMail me at paragkalra@gmail.com


#!/bin/bash
#Author: Parag Kalra
#Date: 14th June, 2008
#Name: php-tags.sh
#Usage: ./php-tags.sh
#Purpose: To automatically add comments and html tags.

# BEGINNING

echo "Enter the name of the shell script: "
read SHNAME

echo "Enter the purpose of this shell script: "
read SHPURPOSE


export SHDATE #='$SHDATE'
export SHNAME #='$SHNAME'
export SHPURPOSE #='$SHPURPOSE'

touch $SHNAME

echo "html tag" >> $SHNAME
echo "head tag, title tag, title end tag, head end title>" >> $SHNAME
echo "body tag" >> $SHNAME

echo "php start tag" >> $SHNAME

echo "#!/bin/bash" >> $SHNAME
echo "#Author: Parag Kalra" >> $SHNAME
echo "#Date: $SHDATE" >> $SHNAME
echo "#Name: $SHNAME" >> $SHNAME
echo "#Usage: ./$SHNAME" >> $SHNAME
echo "#Purpose: $SHPURPOSE" >> $SHNAME

echo "php end tag" >> $SHNAME

echo "body end tag" >> $SHNAME
echo "html end tag" >> $SHNAME

#END OF SCRIPT

No comments: