... the script (v1.2)
The FAQchest
faqchest at abac.com
Thu Nov 15 10:47:41 CST 2001
~sdpm~
Tsss. I grabbed the wrong one! The original stuff I had was from a
package installer that was providing its own copy of PERL, plus was
accepting command line args. In a CGI, you don't need that.
You may also add the the PATH whatever locations you've found PERL
installed on your target systems.
############################################################
#!/bin/sh
#
PATH=${PATH}:/bin:/usr/bin/:/opt/perl5/bin:/usr/local/bin:/usr/5bin:/usr/sbin:/usr/ucb
user_id=`id | sed -e 's/uid=//' | sed -e 's/(.*$//'`
if [ $user_id -eq 0 ]; then
echo 'Content-Type: text/plain; charset=iso-8859-1'
echo ''
echo "Sorry, you can not be running as 'root' in order to run this script."
echo
exit
fi
perl_loc=`which perl | grep perl | sed -e 's,/perl,,'`
if [ ! -x $perl_loc/perl ]; then
echo 'Content-Type: text/plain; charset=iso-8859-1'
echo ''
echo "Error, can not locate 'perl' to run this script."
echo
exit
fi
# Switching to PERL starting from here ##
eval "exec $perl_loc/perl -x $0 $*"
#!perl
## Everything below is a perl script. The preceding line tells perl -x
## where to start reading code.
umask 022;
select STDOUT;
$| = 1;
print STDOUT "Content-Type: text/plain; charset=iso-8859-1\n\n";
print STDOUT "Yup\n";
## The rest of your script goes here
## END
############################################################
~sdpm~
The posting address is: san-diego-pm-list at hfb.pm.org
List requests should be sent to: majordomo at hfb.pm.org
If you ever want to remove yourself from this mailing list,
you can send mail to <majordomo at happyfunball.pm.org> with the following
command in the body of your email message:
unsubscribe san-diego-pm-list
If you ever need to get in contact with the owner of the list,
(if you have trouble unsubscribing, or have questions about the
list itself) send email to <owner-san-diego-pm-list at happyfunball.pm.org> .
This is the general rule for most mailing lists when you need
to contact a human.
More information about the San-Diego-pm
mailing list