Running .sh file inside a shell script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Running .sh file inside a shell script
# 1  
Old 02-17-2013
Running .sh file inside a shell script

Hello,

You might help a newbie like me, I am trying to run a .sh inside my shell script. After running that I need to execute below commands. Here's how my scripts looks like. Hope you can help:
Code:
#!/bin/sh
cd $ORACLE_HOME/owb/bin/unix
./OMBPlus.sh ---> goes to OMB+> directory
cd /app/mes_dwh/omb --> this needs to be executed while inside OMB+>
source execute_all.tcl --> need to be executed while inside OMB+> 
exit ---> need to exit to execute another command 


Thanks in advance....

Last edited by Franklin52; 02-18-2013 at 03:36 AM.. Reason: Please use code tags for data and code samples
# 2  
Old 02-17-2013
Please use code tags as demanded in forum rules.

What does not work in your above script? Any error messags?
# 3  
Old 02-17-2013
Do you know that you can run|source a program by its pathname, without prior cd?
Code:
#!/bin/bash
$OARCLE_HOME/owb/bin/unix/OMBPlus.sh
source /app/mes_dwh/omb/execute_all.tcl

# 4  
Old 02-17-2013
To execute something, you need
  • either a good path, relative or absolute, or have it in a directory in your $PATH,
  • it must have execute permissions to you, and
  • if it is a script, it needs a #! line with a good absolute path to the interpreter, and sometimes just one argument to make the interpreter happy, like -f for awk or sed.
# 5  
Old 02-18-2013
thanks MadeinGermany.... I will try this....

The error I am getting is that after executing ./OMBPlus.sh....
it just stops there and do not do the cd command that I need to do.
# 6  
Old 02-18-2013
Pls post the script ./OMBPlus.sh and / or logs of its execution. Or, provide us with a crystal bowl.
# 7  
Old 02-18-2013
I would recommend to use these paths inside their corresponding script, don't mess with the main script. When it comes to call multiple scripts inside a wrapper script, all requirements should be fulfilled inside the called-script and not in main wrapper script. what you are messing up here is that writing down then paths for called-scripts and then a call is sent to them.
try executing them in a normal way as you would be doing them on command lineby either either
Code:
source

or
Code:
. /full/path/name

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Sqlplus inside shell script writing to tmp file

Hi, facing an issue while calling sqlplus inside shell script. It for some reason goes to tmp file to write something and i get error as permission denied as i dont have access there. ANy idea why sqlplus writes in /tmp and how to change or stop this ? (2 Replies)
Discussion started by: rushikeshs
2 Replies

2. Shell Programming and Scripting

Calling a function in cpp file inside shell script

Hi I need to call a function written in a cpp file with arguments inside the shell script..Can anyone help me how to do this:( (1 Reply)
Discussion started by: rkrish
1 Replies

3. Shell Programming and Scripting

Linux Shell Script to check for string inside a file?

This is what I have so far grep -lir "some text" * I need to check all files on the system for this text, if the text is found I need to change the file permissions so only ROOT has read and write access. How can this be done? (3 Replies)
Discussion started by: mapleleafs89
3 Replies

4. Shell Programming and Scripting

help in running while loop inside a shell script

I have an input file at ./$1.txt with content of seq numbers like : 1234567890 1234589700 . . so on.. I need to take each seq nbr from the input file ,run the query below: select ackname,seqnbr from event where event_text like '%seqnbr( from the input file)' and redirect the... (11 Replies)
Discussion started by: rkrish
11 Replies

5. Shell Programming and Scripting

Making file inside shell script

Hi, i have written a shell script and its working fine till now. Now, i have to enhance it with a small updation. i need to make a file inside my file that will contain the below parameters 1) Customer_id 2) Server_id 3) No. Account All the above variables are already been taken in... (3 Replies)
Discussion started by: dazdseg
3 Replies

6. Shell Programming and Scripting

how to access variables in a config file inside a shell script

I'm writing a shell script. I want to put the variables in a separate config files and use those inside my script. e.g. the config file (temp.conf)will have the values like mapping=123 file_name=xyz.txt I want to access these variables in temp.conf(i.e. mapping and file_name) from inside the... (7 Replies)
Discussion started by: badrimohanty
7 Replies

7. Shell Programming and Scripting

how to redirect the output of a grep command to a file inside a shell script

hi, i wat to get the output of a grep command in a file. but when i am trying out the same grep command in the unix prompt its working fine.. i am getting the output properly.. but when i am writing the same command inside my shell script , its just creating a new output file with no contents... (11 Replies)
Discussion started by: kripssmart
11 Replies

8. UNIX for Dummies Questions & Answers

how to get the output of a grep command to a file inside a shell script

hi, i wat to get the output of a grep command in a file. but when i am trying out the same grep command in the unix prompt its working fine.. i am getting the output properly.. but when i am writing the same command inside my shell script , its just creating a new output file with no contents... (1 Reply)
Discussion started by: kripssmart
1 Replies

9. Shell Programming and Scripting

How to store the outputs of a shell script inside a log file???

My shell script file name is test.sh and the contents of this test.sh file are ps_file="package1.ps" echo $ps_file ps_file1=`echo $ps_file| sed "s/.ps//g"` echo $ps_file1 ps2pdf -dSAFER -sPAPERSIZE=a4 /tmp/A380_RFS24/amm_r0_ps/$ps_file1.ps /tmp/A380_RFS24/amm_r0_pdf/$ps_file1.pdf Now i... (2 Replies)
Discussion started by: sunitachoudhury
2 Replies

10. UNIX for Dummies Questions & Answers

running sed inside script file

i am substituting some text in the xml file using sed, on shell directly it works fine, but when i run it inside script file, it say, the function cant be parsed, i think the prob is due to xml file, kindly help (4 Replies)
Discussion started by: bajaj111
4 Replies
Login or Register to Ask a Question