scripting password prompts

Hi there

Probably a really simple question but I am writing an install script and at certain stages of the install (ie creating a table in mysql) the system prompts for you to enter a password, I was wondering, how do I script this input so that the install doesnt keep stopping for manual intervention??,

thanks and regards
Gary

Try something like this...

#! /usr/bin/ksh

print -n "Enter password - "
stty -echo
read PASSWORD
stty echo
print

Then just use $PASSWORD where you need it.

Thanks Perderabo, its actually the other way round tho, i dont want to read the password, I want to write it ! for example my script issues the command ..

mysql -u root -p test

but before my script can move onto the next line , mysql pops up with an "enter password:" I would like to get my script to enter the password in for me (automatically answering mysql's authentication request)

I hope this clarifies

In this case I think you can use a here file, to do that.

Or for password prompts in general look into using expect, it's the simplest way to do this.