Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Waiting to supply password

Status
Not open for further replies.

dwhalen

Programmer
Feb 22, 2002
105
CA
Hey,

I am trying to automate something that I have to do over and over again, that I think could easily be done in a script in 10 minutes and then I could run it any time....ahhh the lazy programmer :)

What I need done will be some command line stuff (I am working on Linux BTW), but the only thing stopping me is that I have to supply a password to my commands. Part of what I want is to pg_dump (postgresql stuff) some tables, which would require me to send a command to the command line and then supply a password....how do you do this??

I came across this before but I can't remember how to do it!! I think I remember someone telling me there was a function or perl module for this. The exact command would be
Code:
pg_dump -t table_name -c -D -R -f table_name.sql database_name -U myName

Then it asks you for a password.

Any help?

Thanks in advance :)

Later
 
You could try using the Expect suite of tools/modules. I've heard good things about them for things like this but never used it myself. You could try opening the command as a pipe and print to it, or if you want the output saved, too, you can use open2 or open3.

________________________________________
Andrew - Perl Monkey
 
Thanks for the reply icrf. Someone told me to use Expect months ago and then I put this on the back burner and forgot what I had to use. Thanks for the help, you saved me a lot of brain racking!!

I have never used open2 or open3 but I am curious and am going to look into them.

Thanks again.

Later
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top