Pbrun command problem

Hi,
I want to automate pbrun command in one of my project but the problem is when i am running pbrun command then it is asking for some input as identification no.I redirect that number through a file but it's not working. I didn't got any option for that to pass it as command line.Is there any way to pass it so that i should not be forced it to pass as manually.If any one has any idea plz help....

echo "YES" | Passyes.sh

If the above does not work then try using expect(1);

#!/usr/local/bin/expect -f
spawn pbrun $argv 
expect "question" 
send "answer\r"

Replace the "question" string with what pbrun says, replace "answer" with your desired response.

Hi,
The first solution that u provided will work for normal scripts but not for pbrun command.Second one is right but i don't want to use expect.any other solution

If the questions and answers are always in the same order and the programme you are using supports it then you can use heretext, e.g.:

pbrun << EEOOFF
yes
no
1
fred
EEOOFF

Another solution posted here: http://www.unix.com/shell-programming-scripting/63050-exit-shell-prompt-after-pbrun.html\#post302290616
I'm not sure about the security implications in using this method.