Visit Our UNIX and Linux User Community


macro on shell script ?


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers macro on shell script ?
# 1  
Old 08-08-2001
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.
inquirer
# 2  
Old 08-08-2001
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  
Old 08-09-2001
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.

inquirer
# 4  
Old 08-09-2001
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  
Old 08-15-2001
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 Smilie
inquirer
 

Previous Thread | Next Thread
Test Your Knowledge in Computers #485
Difficulty: Medium
A computer operating system loads an executable file into a call stack on a hard disk.
True or False?

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Script solution - running Excel macro in SLES

Hello all, I'm here again with new trouble. I need to find any possible way to apply excel macro on excel file in SLES server, or to convert that macro somehow. Could you please share your ideas, and help me with this? Thank you in advance ps (attached macro is with changed extension,... (14 Replies)
Discussion started by: bigbrobg
14 Replies

2. Shell Programming and Scripting

Converting macro to bash script

Gents, Please can you help me with this. When column 49 == 2 Before X 4714 14710 69445.00 19257.001 1218 12271 69596.00 19460.00 19478.001 X 4714 14710 69445.00 19257.001 1228 12292 69596.00 19480.00 19480.001 After X 4714 14710 69445.00 19257.001 1218... (1 Reply)
Discussion started by: jiam912
1 Replies

3. UNIX for Dummies Questions & Answers

macro

Can I create a macro in UNIX? If so where do I find out how? (1 Reply)
Discussion started by: JD_Sal
1 Replies

4. Shell Programming and Scripting

Invoke a script in UNIX using Excel Macro

Hi, I am using Send Keys to connect to UNIX server and invoke a script . Is there an alternate way to connect to UNIX server using Excel macro and invoke a UNIX Shell script? Anu (2 Replies)
Discussion started by: anandita.jha
2 Replies

5. UNIX for Dummies Questions & Answers

Wanting to run a macro/script from PuTTY

We currently use TUN as an emulation program to connect to various unix applications. I am looking at moving to PuTTY release 0.60 but am getting stuck as one application runs a macro at startup to run a program. My question is, can you run a macro from PuTTY? Any pointers would be great. (0 Replies)
Discussion started by: virtualpaul
0 Replies

6. Programming

Make-question - redefine a macro, using another macro..?

I think there is no problem to use any macro in a new macro definishion, but I have a problem with that. I can not understand why? I have a *.mak file that inludes file with many definitions and rules. ############################################## include dstndflt.mak ... One of the... (2 Replies)
Discussion started by: alex_5161
2 Replies

7. UNIX for Dummies Questions & Answers

Return shell value to a VI macro

Hi, Have searched around for a solution to this and get frustrating close but have not nailed it. vi on HP-UX what I'm trying to do is utilise the key mapping available within Vi to run a shell script which uses awk script to scan the file i'm working on and return the line number or... (1 Reply)
Discussion started by: sjdolding
1 Replies

8. Shell Programming and Scripting

How to launch a Csh shell script using Excel Macro ?

Hi all. I need to use excel macro at my desktop to launch a csh script which is in a solaris environment. What is the code that i can use in macro to help me with that ? Basically, the code need to telnet or ftp to the solaris environment and just run the script and the macro will output in an... (1 Reply)
Discussion started by: Raynon
1 Replies

9. Programming

macro

Can i define a macro for a function of 10 LOC. (9 Replies)
Discussion started by: bankpro
9 Replies

10. UNIX for Dummies Questions & Answers

VI Macro Problem

I'm having a problem with a macro i put in my .exrc file. Here's what I put: map #I ^[ ^ [ is control-v and the escape key. It places a # a the beginning of a line by simply hitting the # on the keyboard. Problem is, now when I hit "o" or "O" to move up or down a line, it places a # at... (1 Reply)
Discussion started by: Atama
1 Replies

Featured Tech Videos