RE: [PHP] Php shell scripting [SOLVED]

From: Jake McHenry (linux_at_nittanytravel.com)
Date: 12/11/03


To: "'Php-general'" <php-general@lists.php.net>
Date: Thu, 11 Dec 2003 00:45:56 -0500


> -----Original Message-----
> From: Evan Nemerson [mailto:evan@coeus-group.com]
> Sent: Wednesday, December 10, 2003 9:32 PM
> To: Jake McHenry; php-general@lists.php.net
> Subject: Re: [PHP] Php shell scripting
>
>
> On Thursday 11 December 2003 12:31 am, Jake McHenry wrote:
> > Does anyone know how I can pass variables into a script
> being executed
> > from the command line?
> >
> > I have a script, named testscript. So far, I have been
> getting all my
> > variables from the system env command, not a big deal. But
> I want to
> > input a username into the script, like testscript jmchenry.
> >
> > In basic shell scripting, the value of any parameters would
> be $1, $2,
> > $3, etc.. within the script, but how can I do this with PHP? Is it

> > even possible?
>
> var_dump($argv);
>
> >
> > Thanks,
> >
> > Jake McHenry
> > Nittany Travel MIS Coordinator
> > http://www.nittanytravel.com
>
> --
> Evan Nemerson
> evan@coeus-group.com
> http://coeusgroup.com/en
>
> --
> "They that can give up essential liberty to obtain a little
> temporary safety
> deserve neither liberty nor safety."
>
> -Benjamin Franklin
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

Thanks for the very quick responses! Here's what I got from your
responses:

var_dump($argv);

This returned NULL, so I tried:

print_r($_SERVER['argv']);

This returned exactly what I wanted.

Thanks,

Jake McHenry
Nittany Travel MIS Coordinator
http://www.nittanytravel.com



Relevant Pages