help me with write script shell to do grid-proxy-init

hi , i have problem with writing script shell to create proxy grid like this:

grid-proxy-init -cert cert.pem -key key.pem

the server will prompt me to enter passphrase(similar to password) in return. the problem is that i don't know how to respond to that request, i try writing script like this :

grid-proxy-init -cert cert.pem -key key.pem
mypassword

but server not recognize it as password . it still waiting there for me to enter password

is there anyway to settle this problem ? thanks for your advice

It won't work. The program reads from your TTY, not standard in/out. If you are trying to make life easier on yourself so you don't have to remember the command, create an alias for the grid-proxy-init command. Then put this alias in your .profile (or .bash_profile).

alias gridlogin="grid-proxy-init -cert $HOME/cert.pem -key $HOME/key.pem"

You'll still need to provide the password, but at least you won't have to remember the command.