I need to call some script (s1) from within my shell script (s2). s1 accepts parameters and I want to feed it with values of params from my script. I tried many things but none work (I am so much of a beginner), please help
one of my attempts :
.
.
.
param1="hehe"
param2="haha"
s1
echo -e "\r"
echo $param1
echo $param2
------------------------------------------------------------------------------------
PS: when I run s1 from command prompt (not from shell I do the following and it works)
>s1 ; I press return key
>enter value of param1: hehe ; I enter hehe then return key
>enter value of param2: haha ; I enter haha then return key
Ok. I just found out that s2 is prolly written in fortran because there are files on my machine as s2.f and s2.o
is it possible to call it from my script at all?
Please help me decide if I'm doing the write thing by writing a "shell script" to automate running this program that I can run from my command line with no problem. I've tried all your suggestions but none worked out. Should I use something else other than shell scripting?
If You can run the program from the command line, You can most certainly run it from within a script. But Your description is still a bit unclear. I get the impression that You want to be able to be prompted for the parameters before You "send" them to s2, is that correct?
The echo in your code will only run when s2 finishes. To provide $param3 as input, try this instead.
s2 param1=val param2=val2 <<HERE
val3
HERE
Whether it works or not depends on whether s2 accepts the remaining parameters as standard input; some programs explicitly read from the terminal, or use some sort of interactive front end which doesn't work with standard input.