Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Automate user input = 'yes' or 'y' 1

Status
Not open for further replies.

h011ywood

Programmer
Joined
Dec 1, 2003
Messages
55
Location
US
I am working on a system recovery utility, and using the 'fsck' command. Although this command has the option -a to attempt to fix ALL errors, there are still certain errors that it requests user input to fix. (Found this through rigorous testing using fsck)

Anybody know of a good way to feed 'yes | y' to the fsck command on the fly? I've also tried to pipe in the linux 'yes' command to fsck, but fsck doesn't like that.

Thanks for any feedback.

Hwood
 
Sounds like a job for Expect or Perl::Expect.
 
Any links for documentation for this module? I have it installed already, just no clue how to use it! From brief descriptions, it looks like this should work for me. Thanks.
 
Thanks raider. I found some documentation, and have my fsck command running and fixing without prompting the user.
 
Just an FYI:

fsck calls e2fsck, and you can specify the -y option to answer yes to everything. A workaround.

`e2fsck -y /dev/hda2`

Its much faster than using expect.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top