Computing.Net > Forums > Programming > Redirect input to a command

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Redirect input to a command

Reply to Message Icon

Name: lei_michelle
Date: October 9, 2008 at 10:18:40 Pacific
OS: Solaris 10
CPU/Ram: intel
Product: SUN
Comment:

Hi All,

I want to redirect the username and the password as two inputs to a UNIX command from a file (the UNIX command prompts for username and password before proceeding). However, I cannot get it to work. The UNIX command still stops at the password prompt. The contents of the input file I used is like below:

user1
passwd1

Any idea what the solution should be?

Thanks in advance!




Sponsored Link
Ads by Google

Response Number 1
Name: nails
Date: October 9, 2008 at 13:43:33 Pacific
Reply:

Under Unix/Linux, typically expect is used to handle interactive programs - especially using the passwd command. Check out this link:

http://www.computing.net/answers/un...


0

Response Number 2
Name: lei_michelle
Date: October 11, 2008 at 06:05:55 Pacific
Reply:

Thank you, Nails!

So automating the username/password is impossible from the shell.


0

Response Number 3
Name: nails
Date: October 22, 2008 at 21:51:40 Pacific
Reply:

Sorry, I didn't see this until just now. Without using something like expect, yes I'm afraid it is.

However, since you are using Solaris, you might find this link interesting:
http://www.unixreview.com/documents...

This link includes a "C" program, setpass, which allows setting a user's password. You might find it useful.



0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: Redirect input to a command

Pass text file to DOS command www.computing.net/answers/programming/pass-text-file-to-dos-command/17398.html

redirect input : java www.computing.net/answers/programming/redirect-input-java/6326.html

Batch: how to assign command to Var www.computing.net/answers/programming/batch-how-to-assign-command-to-var/11248.html