LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware
User Name
Password
Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?

Notices


Reply
  Search this Thread
Old 07-12-2012, 10:57 AM   #1
Xris718
Member
 
Registered: May 2003
Location: NYC
Distribution: CentOS
Posts: 261

Rep: Reputation: 30
/dev/tty stdin


Hi

I have a tripwire program that I need to automate during its system check and accept the changes made on the system. The problem is that its an interactive process and its asking twice for a passphrase to be entered. Based on the man pages it looks like its trying to accept the passphrase from /dev/tty stdin. I wanted to find out if there is a way to redirect the passphrase ran by a shell script to /dev/tty so the process running tripwire can accept the stdin from a script and finish its run.
 
Old 07-12-2012, 12:51 PM   #2
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
Blog Entries: 15

Rep: Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669
This is the kind of thing "expect" is designed to do. Script interactive sessions.

If you do a web search for "using expect" you'll see many examples.
 
Old 07-12-2012, 01:12 PM   #3
Xris718
Member
 
Registered: May 2003
Location: NYC
Distribution: CentOS
Posts: 261

Original Poster
Rep: Reputation: 30
You are correct expect can do it. However I need to do it in shell and wanted to find out if there was some kind of a way.
 
Old 07-12-2012, 01:34 PM   #4
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
Blog Entries: 15

Rep: Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669
You can call expect from shell scripts.

You can try to figure it out shell without expect using Here Document format as described at:
http://en.wikipedia.org/wiki/Here_document

However, the reason I suggested expect was because you said it asks for input twice. That makes it a perfect candidate for expect which allows for multiple ask/response setups.
 
Old 07-12-2012, 02:29 PM   #5
Xris718
Member
 
Registered: May 2003
Location: NYC
Distribution: CentOS
Posts: 261

Original Poster
Rep: Reputation: 30
I know that expect can do it. However I need to do it in shell. This way I have only one syntax code to maintain.
 
Old 07-12-2012, 02:45 PM   #6
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
Blog Entries: 15

Rep: Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669
Quote:
Originally Posted by Xris718 View Post
I know that expect can do it. However I need to do it in shell. This way I have only one syntax code to maintain.
Did you read the rest of my post?
 
Old 07-13-2012, 09:50 AM   #7
Xris718
Member
 
Registered: May 2003
Location: NYC
Distribution: CentOS
Posts: 261

Original Poster
Rep: Reputation: 30
Hi yes I did take a look at the rest of your post and tried it out using the here document approach, however the results were not successful. Tripwire makes its run but fails to accept input twice in automated fashion.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
redirecting /dev/ttyS0 -> stdin goestin Linux - Software 2 10-26-2011 11:34 AM
"stdin is not a tty" when using SCP gutterboy Linux - Server 7 12-06-2010 09:38 AM
WARN: stdin/stdout is not a TTY; using /dev/console alirezan1 Linux - Newbie 4 06-07-2010 09:00 PM
/dev/tty vs /dev/pts anshexp Linux - Kernel 1 09-21-2009 09:13 AM
CVS on a webserver - stdin not tty NoUse4ANick Linux - Server 2 08-28-2008 11:35 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware

All times are GMT -5. The time now is 06:44 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration