Problem in calling a script inside a script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Problem in calling a script inside a script
# 8  
Old 06-22-2012
Quote:
o/p of that command is
/opt/IBM/yahoo/stop.sh
Unless you have an unusual version of ls, that output is impossible.
Anyway we now know that "yahoo" is a directory and that there is probably only one script and that it probably does not vary its location. Therefore we don't need to search.

Can the whole script be condensed to this? :
Code:
#!/bin/bash
/usr/bin/sh /opt/IBM/yahoo/stop.sh & ; PID=$?
/usr/bin/sleep 5
# Check whether we still have any background jobs
if [ -n "`jobs`" ]
then
     kill $PID
fi

This User Gave Thanks to methyl For This Post:
# 9  
Old 06-22-2012
Quote:
Code:
#!/bin/bash
/usr/bin/sh /opt/IBM/yahoo/stop.sh & ; PID=$?
/usr/bin/sleep 5
# Check whether we still have any background jobs
if [ -n "`jobs`" ]
then
     kill $PID
fi

script name will be the same but my location will differ based upon my input... that's why i made a search and find that exact file in the script.... i need to add some more stuffs also.... thanks for your solution ...

Last edited by vbe; 06-22-2012 at 12:10 PM.. Reason: forgot a ] after quote...
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Calling one script inside another

Hi, I am calling a script log.sh from output.sh. Log.sh has below pice of code: IFILE=/home/home1/Report1.csv if awk -F, '$6==0 && $7==0{exit 1}' ${IFILE} then awk -F, ' BEGIN{ c=split("1,6,2,3,4,5,6", col) print "To: abc@gmail.com" print "Subject: Error... (2 Replies)
Discussion started by: Vivekit82
2 Replies

2. Programming

Calling another expect script inside an expect script

I have an expect script called remote that I want to call from inside my expect script called sudoers.push, here is the code that is causing me issues: set REMOTE "/root/scripts/remote" ... log_user 1 send_user "Executing remote script as $user...\n" send_user "Command to execute is: $REMOTE... (1 Reply)
Discussion started by: brettski
1 Replies

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

4. Shell Programming and Scripting

Problem while calling a script within a script

Hi , I have moduled my scripts in three scripts . From First script i am calling second and from second i am calling third for some check . Problem is with the third script call. ---In second script EXP ='test.\abc.\Server.*abc.xml.*' pid=$($HOME/bin/checkpid $EXP) --Third... (2 Replies)
Discussion started by: amrishn
2 Replies

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

6. Shell Programming and Scripting

calling problem in perl script

Hi , Here is my piece of code-- main(); sub main { $result = GetOptions ("LogDir=s" => \$LogDir, "Summary" => \$Summary, "Indiviual=s" => \$Individual , "Diagnostics=s" => \$Diagnostics, ... (1 Reply)
Discussion started by: namishtiwari
1 Replies

7. Shell Programming and Scripting

differences in calling another script inside script

Hello, we can call the script inside another script. like method 1) content of test.sh ######## . test2.sh ####### method 2) content of test.sh ######## test2.sh ####### What is the difference here in both samples calling test2.sh?? i mean calling with ". " and calling... (1 Reply)
Discussion started by: balareddy
1 Replies

8. Shell Programming and Scripting

Problem with Calling sql file from shell script

I have created abc.sh file which will set the environment variables (UNIX env variables as well as ORACLE required variables like ORACLE_SID,ORACLE_HOME etc) and then calls a function file which checks for starts some logs and then it will try to execute the .sql file. The .sh, function file are as... (1 Reply)
Discussion started by: sskc
1 Replies

9. Shell Programming and Scripting

shell script calling problem

Hi all, I am calling one shell script from other ...as follow ---calling_proc---code line_no=10 proc_name='test' echo "set verify off feedback off pagesize 0 select count(*) from tp_mpolicy2 " | sqlplus -s/@CMKT | read cnt if ; then export $line_no $proc_name global_proc... (2 Replies)
Discussion started by: dhananjaysk
2 Replies

10. Shell Programming and Scripting

calling a C executable from inside a Perl script

here's the Perl code snippet... how can i call my C executable 'porter-stemmer' and pass it $1 as an argument? Thanks for the help! # Read through the original topic set, and modify based on the current # pre-processing options while (<TOPIC_ORIG>) { # Run pre-processing over only the... (3 Replies)
Discussion started by: mark_nsx
3 Replies
Login or Register to Ask a Question