LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices



Reply
 
Search this Thread
Old 01-18-2010, 12:41 PM   #1
JoeyJoeJoeJr
LQ Newbie
 
Registered: Jan 2010
Posts: 2

Rep: Reputation: 0
Script to run terminal interface program automatically


Hello all

I have to run a program repeatedly that demands a few responses from the users when run: a few yes/no questions and a filename. To save time I was going to use a script. I already use this one to run the program once ("program" is the command to launch the program I use):

Code:
program << echo
file.log
y
n


e
But I'm not sure how to get it to work again for another file. This doesn't work, it only opens the program once:

Code:
program << echo
file1.log
y
n


e
program << echo
file2.log
y
n


e
Thanks!
 
Old 01-18-2010, 01:13 PM   #2
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Servers: Debian Squeeze and Wheezy. Desktop: Slackware64 14.0. Netbook: Slackware 13.37
Posts: 8,563
Blog Entries: 29

Rep: Reputation: 1179Reputation: 1179Reputation: 1179Reputation: 1179Reputation: 1179Reputation: 1179Reputation: 1179Reputation: 1179Reputation: 1179
You are using a here document (browse down to 3.6.6) but not terminating it. The terminating word you have defined is "echo" which is legitimate but confuzzling. EOF (for end of file) is conventional. Try
Code:
program << EOF
file1.log
y
n


e
EOF
program << EOF
file2.log
y
n


e
EOF
 
1 members found this post helpful.
Old 01-18-2010, 01:21 PM   #3
JoeyJoeJoeJr
LQ Newbie
 
Registered: Jan 2010
Posts: 2

Original Poster
Rep: Reputation: 0
Cheers catkin!

I'm new to this so didn't know I was even using a here document, and yes the echo was very confusing!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
How can Fedora run automatically a Terminal command at the startup? cesar7160 Fedora 4 05-19-2009 12:54 PM
how to run a program automatically when booting up? shj339 Linux - General 1 05-05-2008 06:10 AM
Automatically starting a program in a new terminal Uruclef Linux - General 2 05-05-2007 02:46 PM
start terminal & run command automatically peeples Linux - General 2 09-08-2003 03:57 PM
How do I automatically run at boot an X program or script cmisip Linux - General 4 01-05-2003 07:30 PM


All times are GMT -5. The time now is 07:24 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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration