The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com



UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
How to launch a Csh shell script using Excel Macro ? Raynon Shell Programming and Scripting 1 11-08-2006 12:22 PM
Regarding #ident macro sarwan High Level Programming 1 10-06-2006 04:17 AM
macro bankpro High Level Programming 9 02-01-2006 12:52 PM
USRSTACK macro jalburger HP-UX 1 12-03-2004 04:58 PM
VI Macro Problem Atama UNIX for Dummies Questions & Answers 1 05-16-2002 12:13 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 08-08-2001
inquirer
Guest
  
 

Posts: n/a
Bits: 0 [Banking]
macro on shell script ?

in shifts we used to run a script where in we need to choose from different options. for example the first part would go like this:
========
menu
========
1)blah
2)blah blah
3)blah blah blah

you have chosen:

then after that a series of multiple choice so on and so forth...what i would like to do is every time i run that script another script/macro will answer those multiple choice for me. is that possible? help me on this.
  #2 (permalink)  
Old 08-08-2001
PxT's Avatar
PxT PxT is offline Forum Advisor  
Registered User
  
 

Join Date: Oct 2000
Location: Sacramento, CA
Posts: 909
Put your choices in a file (we'll call it answers.txt), one per line. Ex:


1
3
2
4


Then run your script with the answers piped in:

./mymenu.sh < answers.txt
  #3 (permalink)  
Old 08-09-2001
inquirer
Guest
  
 

Posts: n/a
Bits: 0 [Banking]
follow up question...

thanks for the reply PxT. i've that in the office and it worked just fine. but there is one more problem to it. as i have just said before that these scripts are series of multiple questions... it came to a point where there are no choices to make instead i have to press ENTER to choose default where is not included in the multiple choice. how can i put a "carriage return" in the macro? to illustrate:

==========
menu
==========
1)blah
2)blah blah
3)blah blah blah

you have chosen (ENTER=default blah):

thanks for the help but i still need this very much.

  #4 (permalink)  
Old 08-09-2001
LivinFree's Avatar
LivinFree LivinFree is offline Forum Advisor  
Goober Extraordinaire
  
 

Join Date: Jul 2001
Location: Portland, OR, USA
Posts: 1,584
You can try hitting Ctrl-V Ctrl-M. You should see a "^M" on the screen... also, you can try typing:
\ctrl-M
On some systems, the \ escapes the < cr >... If neither of those work, try just putting a blank line in...

HTH
  #5 (permalink)  
Old 08-15-2001
inquirer
Guest
  
 

Posts: n/a
Bits: 0 [Banking]
sorry for the delayed reply... but

hey, i tried your suggestion and it worked fine... it just does not apply for scripts with loops. coz you said that if the selection requires only a carriage return just leave a blank or use ^M or ^V. well the blank thing work it just that if the script that you are trying to run the macro will loop at the end the output will be that it will endlessly try to throw in the carriage return as a result of an endless loop.

to illustrate the script constains the following loop:

until "$quit" = "y"
do

(menu1)
(menu2)
(menu3)
...

done

see my problem? after issuing all the command at the end it will see only carriage return. i only solution i could think of is to quit the application and try to run the script again. anyway, thank you very very much for the reply. i learned a lot from this site. i hope to seek more answers from all of you
Sponsored Links
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -4. The time now is 04:17 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language translation by Google.
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0