Feeding password in bash script

Hello

I am doing some test.

In a script I have to call a change password routine ( ldap ) which ask confirmation. This can be done from terminal.

Is there a way to do something like this :

#!/bin/bash
#
blabla
blabla
blabla
blabla

# changing_password_routine user_name new-password new-password
user_name=$1
new-pass=$2
smbldap-passwd $user_name < $new-pass $new-pass

# end

I have try it dose not work.
smbldap-passwd $user_name
new password :
Retype new password :

thank you for helping

jcd

Password prompts go to /dev/tty, so when you script them, you need a way to create a pseudo-tty: expect, rsh, ssh, telnet. However, changing to passwordless trusted public-private key authentication is a much better practice.

I know that, but I am doing brute force test with false user on false ldap database so it does not matter. I am just fed up with typing password.

So if you can help me it would be great.

Thank you for helping.

JCD