Home > Archive > PERL Beginners > November 2006 > Beginner question
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
|
|
| Junaid Shariff 2006-11-30, 7:56 am |
| Hello,
I am new to perl and have a doubt. I have a script that needs to run a
command. The command that is being run requires input from the user to
proceed. Instead of prompting the user how can I code the utility to not
prompt the user but take the input from a variable that has the value that
is to be input.
Thanks.
| |
| Bjorge Solli 2006-11-30, 7:56 am |
| Hello and welcome!
On Thursday 30 November 2006 10:32, Junaid Shariff wrote:
> I am new to perl and have a doubt. I have a script that needs to run a
> command. The command that is being run requires input from the user to
> proceed. Instead of prompting the user how can I code the utility to not
> prompt the user but take the input from a variable that has the value that
> is to be input.
Check if the command can take arguments to set the input. If it can, this i=
s=20
the best way to do it.
Alternatively you can get help from this:
http://alumnus.caltech.edu/~svhwan/...DocsGenMel.html
=2D-=20
Bj=C3=B8rge Solli - Office:+47 55205847
Mohn-Sverdrupsenteret, Nansensenteret, H=C3=B8yteknologisenteret T47
Thorm=C3=B6hlensgate 47, 5006 Bergen, Norway - www.nersc.no
Google Earth: www.nersc.no/GE - TOPAZ: topaz.nersc.no
| |
| Gergely Buday 2006-11-30, 7:56 am |
| > I am new to perl and have a doubt. I have a script that needs to run a
> command. The command that is being run requires input from the user to
> proceed. Instead of prompting the user how can I code the utility to not
> prompt the user but take the input from a variable that has the value that
> is to be input.
$main::ENV{VARIABLE}
contains the value of the shell variable VARIABLE.
I hope this helps
- Gergely
| |
| Junaid Shariff 2006-11-30, 7:56 am |
| Hello again. Thanks for the prompt reply. Not sure if i explained my doubt
clearly.
Basically I run the ncpmount command, which requires the user to enter the
remote server password. But that password has already been entered by the
user once before and is stored by me in a variable. Now when I have,
system ('ncpmount -S <remote ip>' -U <host> /mount/point');
in my script, the script prompts the user again to enter the password. Which
is not what I want to happen. Instead I want the password to be read in my
script from a variable. Hope that clarifies my doubt.
| |
| Bjorge Solli 2006-11-30, 7:56 am |
| On Thursday 30 November 2006 11:14, Junaid Shariff wrote:
> Hello again. Thanks for the prompt reply. Not sure if i explained my doubt
> clearly.
> Basically I run the ncpmount command, which requires the user to enter the
> remote server password. But that password has already been entered by the
> user once before and is stored by me in a variable. Now when I have,
>
> system ('ncpmount -S <remote ip>' -U <host> /mount/point');
>
> in my script, the script prompts the user again to enter the password.
> Which is not what I want to happen. Instead I want the password to be read
> in my script from a variable. Hope that clarifies my doubt.
Read The Manual: http://www.die.net/doc/linux/man/man8/ncpmount.8.html
system ("ncpmount -S $remote_ip -U $user_name -P $password $mount_point");
=2D-=20
Bj=C3=B8rge Solli - Office:+47 55205847
Mohn-Sverdrupsenteret, Nansensenteret, H=C3=B8yteknologisenteret T47
Thorm=C3=B6hlensgate 47, 5006 Bergen, Norway - www.nersc.no
Google Earth: www.nersc.no/GE - TOPAZ: topaz.nersc.no
| |
| Junaid Shariff 2006-11-30, 7:56 am |
| Thanks Solli. :-)
| |
| Uri Guttman 2006-11-30, 6:57 pm |
| >>>>> "BS" == Bjorge Solli <bjorge.solli@nersc.no> writes:
BS> Check if the command can take arguments to set the input. If it
BS> can, this is the best way to do it.
BS> Alternatively you can get help from this:
BS> http://alumnus.caltech.edu/~svhwan/...DocsGenMel.html
those pages are from 2001 and are a typical mixed bag of web tutorial
stuff that i would never recommend. this page shows the author doesn't
know about autovivification even as he codes to avoid it:
http://alumnus.caltech.edu/~svhwan/...bDepthHash.html
he doesn't realize that the preassignment of {} is not needed as perl
will do that for you.
there are many other mistakes or poor perl examples there. avoid this
site.
uri
--
Uri Guttman ------ uri@stemsystems.com -------- http://www.stemsystems.com
--Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
Search or Offer Perl Jobs ---------------------------- http://jobs.perl.org
|
|
|
|
|