Re: Environment variables in startup.pl
Scott Alexander ([EMAIL PROTECTED]) said something to this effect on 04/27/2001: > Should this work in a startup.pl file > > my $hostname = $ENV{"HOSTNAME"} ; > > from the prompt I can write echo $HOSTNAME and get the correct > hostname of the server. > > But from within startup.pl I don't get it. > > Scott use Sys::Hostname; $host = hostname; (darren) -- vi, vi, vi - the Editor of the Beast
Re: Environment variables in startup.pl
Hi there, On Fri, 27 Apr 2001, Philip Mak wrote: > On Fri, 27 Apr 2001, Scott Alexander wrote: > > > Should this work in a startup.pl file > > > > my $hostname = $ENV{"HOSTNAME"} ; > > from the prompt I can write echo $HOSTNAME and get the correct hostname of the >server. > > But from within startup.pl I don't get it. > > Try this: > > my $hostname = `/bin/hostname`; Or better still: http://perl.apache.org/guide 73, Ged.
Re: Environment variables in startup.pl
On Fri, 27 Apr 2001, Scott Alexander wrote: > Should this work in a startup.pl file > > my $hostname = $ENV{"HOSTNAME"} ; > > from the prompt I can write echo $HOSTNAME and get the correct > hostname of the server. > > But from within startup.pl I don't get it. The reason "echo $HOSTNAME" works from the prompt is because /etc/profile contains the command HOSTNAME=`/bin/hostname`. When you're in a non-interactive environment, that's not available. Try this: my $hostname = `/bin/hostname`; -Philip Mak ([EMAIL PROTECTED])