Running a script from if block inside another script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Running a script from if block inside another script
# 1  
Old 12-12-2009
Running a script from if block inside another script

how do i run a script from if block inside another script?

this is what i tried but it doesnt seem to work:

if test $a -eq $w
then
sh /home/scripts/script1.bash
fi
# 2  
Old 12-12-2009
Your attempt looks correct. What error you are getting ?
# 3  
Old 12-15-2009
Possibly try if your using sh:

Code:
if [ $a -eq $w ]
then sh /home/scripts/script1.bash
fi

# 4  
Old 12-15-2009
hi, thanks a lot..there was a problem with my if block.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Capture run time of python script executed inside shell script

I have bash shell script which is internally calling python script.I would like to know how long python is taking to execute.I am not allowed to do changes in python script.Please note i need to know execution time of python script which is getting executed inside shell .I need to store execution... (2 Replies)
Discussion started by: Adfire
2 Replies

2. Shell Programming and Scripting

How to merge Expect script inside shell script?

Hi I have two scripts one is Expect and other is shell. I want to merge Expect code in to Shell script so that i can run it using only one script. Can somebody help me out ? Order to execute: Run Expect_install.sh first and then when installation completes run runTests.sh shell script. ... (1 Reply)
Discussion started by: ashish_neekhra
1 Replies

3. Shell Programming and Scripting

Running a script as root but with different users inside

Hi All, my script.sh has the below lines, and i need to run the script as root or wam. please tell me if this will work #!/bin/bash sudo -t wam /usr/local/wam/stopwam -r ------- this needs run as wam user /usr/local/web/stopweb -a --- this needs to run as... (18 Replies)
Discussion started by: nanz143
18 Replies

4. Shell Programming and Scripting

Script will keep checking running status of another script and also restart called script at night

I am using blow script :-- #!/bin/bash FIND=$(ps -elf | grep "snmp_trap.sh" | grep -v grep) #check snmp_trap.sh is running or not if then # echo "process found" exit 0; else echo "process not found" exec /home/Ketan_r /snmp_trap.sh 2>&1 & disown -h ... (1 Reply)
Discussion started by: ketanraut
1 Replies

5. Shell Programming and Scripting

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: #!/bin/sh cd $ORACLE_HOME/owb/bin/unix ./OMBPlus.sh ---> goes to OMB+> directory cd... (10 Replies)
Discussion started by: aderamos12
10 Replies

6. Shell Programming and Scripting

Passing username and password to a script running inside "expect" script

Hi I'm trying to run a script " abc.sh" which triggers "use.sh" . abc.sh is nothing but a "expect" script which provides username and password automatically to the use.sh script. Please find below the scripts: #abc.sh #!/usr/bin/expect -f exec /root/use.sh expect "*name*" send... (1 Reply)
Discussion started by: baddykam
1 Replies

7. 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

8. Shell Programming and Scripting

Running a unix script(which is calling another script inside that) in background

Hi all, I am having a script ScriptA which is calling a script ScriptB in the same server and copying files to second server and have to execute one script ScriptC in the second server. THis First script ScriptA is the main script and i have to execute this process continously. for Keeping... (2 Replies)
Discussion started by: rohithji
2 Replies

9. Shell Programming and Scripting

Call a perl script inside a shell script

Hi all, I have the following snippet of code.. #!/bin/sh echo "run perl script............" #Run the verification script perl bill_ver echo " perl script completed....." echo "rename files......" #Remove from all file in the directories test, test1, test2, test3 for f in... (3 Replies)
Discussion started by: chriss_58
3 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