Thanks.. that helps out a lot. Next question.. is there a way I can
prompt for input? For example.. have a prompt "Name: ".. that waits for
the user to enter their name.. and then assignes whatever they enter to
a variable.  Think you can help? :)

Thanks...

---------------------
Ryan Christensen

> -----Original Message-----
> From: Kees Hoekzema [mailto:[EMAIL PROTECTED]] 
> Sent: Sunday, July 22, 2001 11:41 AM
> To: Ryan Christensen
> Cc: [EMAIL PROTECTED]
> Subject: RE: [PHP] PHP shell scripting.. 
> 
> 
> Hello Ryan,
> 
> Let me give you an example :)
> Lets use your script,
> ------------------------
>  #!/usr/local/bin/php -q
> 
>  <?
>  print "I am: $name\n";
>  ?>
> ------------------------
> 
> i called it echo-name.php and chmod 755 it.
> Next, im going to call it:
> 
> --------------------------
> Athena:~$ name=kees
> Athena:~$ ./echo-naam
> I am: kees
> --------------------------
> 
> So the trick is to set the variable BEFORE you call the 
> script you can see all variables already used by linux with 
> "set" you'll get something like this:
> 
> --------------------------
> Athena:~$ set
> BASH=/bin/bash
> BASH_VERSINFO=([0]="2" [1]="03" [2]="0" [3]="1" [4]="release"
> [5]="i386-slackware-linux-gnu") 
> BASH_VERSION='2.03.0(1)-release' COLUMNS=80
> DIRSTACK=()
> 
> (...snip...)
> 
> TERM=xterm
> UID=1034
> USER=kees
> _=./echo-naam
> file=/etc/profile.d/tetex.sh
> ignoreeof=10
> name=kees
> -----------------------------
> 
> As you can see, our variable name is there, and it is set.
> to set a variable, simply type this at the commandline (or script)
> -------------
> variable=value
> ---------------
> where variable is your variable and value your value :)
> 
> Good luck :)
> -Kees


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to