views:

121

answers:

3

Is there any way so that i can echo password when asked for in unix shell without use of external binaries ? Something like simple function triggered when password prompt is displayed

+1  A: 

Are you aware of Expect?

Perhaps this falls in the "external binaries" category, but if it does, then your question needs clarification.

ΤΖΩΤΖΙΟΥ
Can you clarify this question?
Bartosz Blimke
What is the controlling entity that will "echo" the password to another program?
ΤΖΩΤΖΙΟΥ
A: 

well expect IS external binary.

Mote
Should be added as extra information to the question or as a comment on the other answer.
workmad3
+1  A: 

Short answer: no.

Slightly longer answer: the usual shells, sh, ksh, csh, tcsh, bash do not have any hooks for you to hang actions on (OK, so bash2 has context sensitive tab-completion).


On the other hand. The shell is just a program. You can replace it. If you can really say what you want to do you can hack and existing shell or write a new one to get the desired behavior...

dmckee