From the UNIX command line I would like to prompt the user for a
password using getpass (to hide the password) and then pipe the
password to a korn shell script.
Here is what I have tried so far:
#include <stdlib.h>
/* hide_password.c */
int main(argc, argv)
int argc;
char *argv[];
{
char *pw;
char cmdline[128];
pw = getpass("Password: ");
sprintf(cmdline,"use_password.ksh %s",pw);
system(cmdline);
---------------------------------Quote:}
#!/bin/ksh
# use_password.ksh
print $1
---------------------------------
$ hide_password | use_password.ksh
Password:
Broken Pipe
$
---------------------------------
Can anyone help me with this?
Thanks
Sent via Deja.com http://www.deja.com/
Before you buy.