You can always try to pass it via STDIN, but most programs does not allow this.
For example, the STDIN directional syntax is the "<<<" part.
Code:
mysql -uroot -p database <<< "SELECT * FROM tblname;"
MySQL takes from STDIN and passes it as a command on the prompt. I've seen applications which can do this with password requests also.
For example, if $password is set to "123qwe":
Code:
yourapplication-binary <<< "$password"
If this doesn't work then I'd recommend to use Expect, but that is not a bash issue.
Best regards
Fredrik Eriksson