script file help


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting script file help
# 1  
Old 02-13-2004
script file help

Hi, I'm runing a tool under unix. As soon as the tool is started, it will get into interactive mode. So I need to type in some command s like "run", "print" and so on. Is it possible to use a script file to input the commands instead of typing on the keyboard every time? Thanks a lot!
# 2  
Old 02-13-2004
Gonna need a wee bit more information about the "tool" you speak of! Basically, you want to make an interactive session into a non-interactive session! Any particular reason? There is a scripting language called "Expect" that does this sort of thing. Cant tell you if it will work for you until you provide more details about what it is you are doing.
# 3  
Old 02-13-2004
It will probably matter what the tool is and the OS/version you are running. You might want to post that information.

Otherwise, you can look into a product called Expect - if you search this site you will find postings about the product and what it is good for. Or check out Expect home page

(Looks like Google types quicker than I do!)
# 4  
Old 02-13-2004
.....

Last edited by druuna; 05-21-2009 at 10:17 AM..
druuna
# 5  
Old 02-13-2004
Hi, Guys:
Thanks all of you so much!

The tool I'm using is "SPICE3", which is a circuit design tool. The environment in which I'm running is as follows:
Machine hardware: sun4u
OS version: 5.8
Processor type: sparc
Hardware: SUNW,Ultra-1

What I'm going to do is:
1. Start the tool: SPICE3 circuit_example.sp
where SPICE3 is the name of the tool, and circuit_example.sp is the file name where the circuit is saved.

2. Then SPICE3 goes into interaction mode, waiting for more input from the keyboard. It looks like this:
spice 1 ->

3. Usually I type in "run" at this moment, and SPICE begin to run the circuit.

4. After running, still in the interactive mode, I want to print out some results (like current and so on) and save them to the output file. What I'm doing is like this:

spice 2 -> print i(v1) i(v2) i(v3)+i(v4) > output1.txt

where, I was printing current i(v1), i(v2), and the summation of i(v3) and i(v4) to the output file, which is named output1.txt here.

5. After I output all the results I want, I type in "quit", and SPICE3 will ask me "are you sure", then I type in "y", the SPICE3 then be closed.


So that's what I'm doing so far. I need to type in commands like that by hand. I'm trying to use different resistance, capacitance, and transistor parameters in the circuit to make the circuit give me a good performace. So for each group of parameter combination, if I do step 1 to step 5 by hand, it's quite a labor and wasting time. Therefore, I'm wondering whether the script file could do this work for me.

Any further help and comment will be greatly appreciated!
# 6  
Old 02-13-2004
Hi, Druuna:
The file I was writing is like this:

#!/bin/csh -f
spice3 testdc.sp<<HERE
run
HERE


But it doesn't work, and the output of running this sript is:
"
Circuit: *test file for DC

Warning: no nodes given: .print i(vd)
Note: No ".plot", ".print", or ".fourier" lines; no simulations run
"

It's like spice3 is started, but "run" doesn't be excuted.

Did I use "HERE" in the right way?

Thanks a lot!
# 7  
Old 02-13-2004
.....

Last edited by druuna; 05-21-2009 at 10:18 AM..
druuna
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

ksh Script, Reading A File, Grepping A File Contents In Another File

So I'm stumped. First... APOLOGIES... my work is offline in an office that has zero internet connectivity, as required by our client. If need be, I could print out my script attempts and retype them here. But on the off chance... here goes. I have a text file (file_source) of terms, each line... (3 Replies)
Discussion started by: Brusimm
3 Replies

2. Shell Programming and Scripting

Shell script (sh file) logic to compare contents of one file with another file and output to file

Shell script logic Hi I have 2 input files like with file 1 content as (file1) "BRGTEST-242" a.txt "BRGTEST-240" a.txt "BRGTEST-219" e.txt File 2 contents as fle(2) "BRGTEST-244" a.txt "BRGTEST-244" b.txt "BRGTEST-231" c.txt "BRGTEST-231" d.txt "BRGTEST-221" e.txt I want to get... (22 Replies)
Discussion started by: pottic
22 Replies

3. Shell Programming and Scripting

What is the function of the following lines at the top of a shell script file: Directory and Script?

The file starts like this: Directory: <path to the script> Script: <script fife name> #!bin/ksh ##Comments <actual script> What is the use of the first two lines in the script? What if I save the file without them? What will be the effect? They are not comments. Im very new to this,... (4 Replies)
Discussion started by: remytom
4 Replies

4. Shell Programming and Scripting

Need output of script on screen and file with correct return status of the called script.

Hi, I am trying to capture logs of the script in the file as well as on the screen. I have used exec and tee command for this. While using exec command I am getting the correct output in the file but, script output is not getting displayed on the screen as it get executed. Below is my sample... (14 Replies)
Discussion started by: Prathmesh
14 Replies

5. Shell Programming and Scripting

Call a Perl script within a bash script and store the ouput in a .txt file

I'm attempting to write a bash script that will create a network between virtual machines. It accepts three arguments: an RSpec that describes the network topology, and two list of machines (servers and clients). I have a (working) Perl script that I want to call. This Perl script takes an RSpec... (6 Replies)
Discussion started by: mecaka
6 Replies

6. Shell Programming and Scripting

Script to call a menu script and redirect each option to a text file

Hello, I want to design a script that will call an existing menu script and select options one by one and redirict the out put to a file. For example;- In the script MENU.sh there are 10 options i want to design a script MENU2.sh that will select option 2 3 4 6 7 10 and redirict the output... (4 Replies)
Discussion started by: spradha
4 Replies

7. Shell Programming and Scripting

Script to read a log file and run 2nd script if the dates match

# cat /tmp/checkdate.log SQL*Plus: Release 11.2.0.1.0 Production on Mon Sep 17 22:49:00 2012 Copyright (c) 1982, 2009, Oracle. All rights reserved. Connected to: Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - 64bit Production FIRST_TIME NEXT_TIME... (1 Reply)
Discussion started by: SarwalR
1 Replies

8. Shell Programming and Scripting

Need bash script to ping the servers and rename the output file each time the script is ran

HI, I have a file serverlist in that all host names are placed. i have written a small script #./testping #! /bin/bash for i in `cat serverlist` do ping $i >> output.txt done so now it creates a file output.txt till here fine.. now each time i run this script the output file... (4 Replies)
Discussion started by: madhudeva
4 Replies

9. Shell Programming and Scripting

(Urgent):Creating flat file using sql script and sqlplus from UNIX Shell Script

Hi, I need help urgently for following issue. Pls help me to resolve this issue. I am calling sql script file(file1.sql) from UNIX Shell Script(script1.ksh) using sql plus and trying to create flat file that contains all records returned from SQL query in SQL script(file1.sql) I given... (6 Replies)
Discussion started by: praka
6 Replies

10. Shell Programming and Scripting

Reading file names from a file and executing the relative file from shell script

Hi How can i dynamically read files names from a list file and execute them from a single shell script. Please help its urgent Thanks in Advance (4 Replies)
Discussion started by: anushilrai
4 Replies
Login or Register to Ask a Question