How can I execute another shell from my ksh script?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting How can I execute another shell from my ksh script?
# 1  
Old 09-17-2010
How can I execute another shell from my ksh script?

I am newbie in UNIX, so please excuse me for the stupid question.Smilie
Here is a problem:
I created ksh script where the part of the functionality include an opening of a second session with another shell process "runrep"(runrep is a custom reporting shell designed by Advent Geneva).
When I run my script as it is now, as soon as it rich the line where it suppose to load a second shell - it just stuck at this point. In the output window I can see a child shell prompt. Looks like the second thread is created and the original thread is just waiting for the the child thread to complete.
Here is my questions:
1) How can I prevent my script from opening a new thread, so it would re-use the current thread and would be able to interact with the new shell?
2) If second thread is necessarily, how can I do command exchange between two shell threads?

Thank you for your help.
# 2  
Old 09-17-2010
If it is possible, please, put the part of your script where it stops, the messages you have. With this will be easier to help you!

Regards.
# 3  
Old 09-17-2010
Here is where is stops:

Code:
#open runrep shell
runrep -u $RUNREP_USER -w $RUNREP_PWD -f empty.lst

After this line, I have runrep-specific command "run report". However, it is just stop, unable to move forward, and showing me a new shell prompt:
runrep>

Last edited by Scott; 09-17-2010 at 04:33 PM..
# 4  
Old 09-20-2010
Just found the solution - it is "Here document"

Code:
#open runrep shell
${GVHOME}/bin/runrep -f empty.lst -u ${RUNREP_USER} -w ${RUNREP_PWD} <<EOF
    read ${RSL_NAME}
    runfile ${RSL_NAME} -p ${PORTFOLIO_NAME} -f ${FORMAT} -o ${OUT_FILENAME}
    quit
EOF

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Execute a shell script in UNIX m/c from win 7 using ksh

I need to run a shell script on unix machine from windows 7. I used the "RSH" command in win XP successfully for this, But on win 7 it is not working. Can any body tell me how to run RSH on win 7 or any other command for similar use. I use the command as below rsh <unix m/c> -l <username>... (1 Reply)
Discussion started by: arup1980
1 Replies

2. Shell Programming and Scripting

ksh script to execute 2 variabless in universe enviroment

Hello, Im trying to write a ksh script that will enter the universe environment as user kourier (switching to this specific user automatically launches to the TCL prompt). At the TCL " > " prompt i want to execute two variables. However, it wont recognize the second variable (user input Answer) due... (6 Replies)
Discussion started by: seekryts15
6 Replies

3. Shell Programming and Scripting

Batch script to execute shell script in UNIX server

Hi team, My requirement is to transfer pdf files from windows machine to unix server and then from that unix server we should sftp to another server. I have completed the first part i.e From windows to using to unix server with the help of psftp.exe code: psftp user@host -pw password <... (1 Reply)
Discussion started by: bhupeshchavan
1 Replies

4. Shell Programming and Scripting

Dos batch script to execute unix shell script

Can anyone help me with a dos batch script to execute a shell script residing in an unix server. I am not able to use ssh. Thanks in advance (2 Replies)
Discussion started by: Shri123
2 Replies

5. Shell Programming and Scripting

how to execute ksh simple shell script without creating .sh file

please help me to execute a simple shell script like for i in `ls echo $i done . i dont want to create a new sh file to execute it. Can i just type and execute it ? because I always this kind of simple for loops . Please help . Thanks (7 Replies)
Discussion started by: Sooraj_Linux
7 Replies

6. Shell Programming and Scripting

KSH Script to Execute command from specific column in file

Hi Unix Experts,Team I have a file (say comand_file.prm), The file has a command specified in column 6 (say "./execute_script.sh"). I want to execute this command in my script. I am writing a KSH script to achieve this. Could you please assist me with this. (6 Replies)
Discussion started by: Jeevanm
6 Replies

7. Windows & DOS: Issues & Discussions

Windows remote to Solaris to execute ksh script

Hi all, I'm not sure if it is correct to post here. I am facing problem wanting to create a batch that run from my Windows XP pc to remote to multiple Solaris server to execute the server's ksh script. :wall: Can anyone give me a hints on how to do that? Thanks. (6 Replies)
Discussion started by: beginningDBA
6 Replies

8. Shell Programming and Scripting

How to use ssh execute other shell script on other host (shell script include nohup)?

i want use ssh on the host01 to execute autoexec.sh on the host02 like following : host01> ssh host02 autoexec.sh autoexec.sh include nohup command like follwing : nohup /home/jack/deletedata.sh & after i execute ssh host02 autoexec.sh one the host01. i can't found deletedata.sh... (1 Reply)
Discussion started by: orablue
1 Replies

9. Shell Programming and Scripting

Execute unix shell script to text file using the script

Hi all, I am beginner in UNIX...I want to use unix shell script to create text.file...I know how to use using by command...can anybody tell me for the script? Thanks i changed the threads title from "tex file" to "text file", because "tex" would probably be misunderstood as reference to... (4 Replies)
Discussion started by: mastercar
4 Replies

10. Shell Programming and Scripting

execute a ksh script from perl script!

Hi, I have used exec ("/bin/ksh -c /path/file.ksh arg1"); to execute the file.ksh script from a test.pl script. But it doesnt work.. can anyone tell me what exactly the systax should be?... i have tried system("/path/file.ksh arg1"); too....still no luck... quick replies are highly appreciated (1 Reply)
Discussion started by: meghana
1 Replies
Login or Register to Ask a Question