Calling a script from another


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Calling a script from another
# 1  
Old 08-12-2004
Calling a script from another

Hi,

I have 2 scripts, one is the .profile and the other is a SID selector for Oracle Databases.

But when I call one from the other, even though it seems to have worked, it doesn't.

Can anyone help??


******************* .profile**********************

#!/bin/ksh


. /data/u/amin/oracle/oraenv.sh





***************** . oraenv.sh (SID Selector)
#!/bin/ksh


# Environment Variables for Oracle 92

export ORACLE_BASE=/oracle
export ORACLE_HOME=/oracle/92
# PATH=$ORACLE_HOME/bin:$ORACLE_HOME/Apache/Apache/bin:$PATH
export ORACLE_OWNER=oracle
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/usr/openwin/lib:/usr/dt/lib
export PATH=$ORACLE_HOME/bin:$PATH


# Oracle Environment SID Selector


# Script to select From the Multiple SIDs on this machine
echo
echo
echo "The following SIDs reside on this Box"
cat /var/opt/oracle/oratab | awk -F: '{print $1}' | grep -v "#"
ORAENV_ASK=YES
/usr/local/bin/oraenv


Can anyone help??

Ta.

Deln
# 2  
Old 09-01-2004
Could it be that the last line in oraenv.sh

/usr/local/bin/oraenv

should be

. /usr/local/bin/oraenv

?
# 3  
Old 09-01-2004
I found out that as this goes through Exceed, it is waiting for a prompt we can't see, which is why. Apparently, someone tells me this script will never work in Exceed. I am yet to accept that.

It however works from Console or Telnet.

Thanks,

Del.
# 4  
Old 09-01-2004
Why would you call your oraenv shell from within your .profile? Why not let your users simply run the shell? If this is not working through Exceed but it is working through Telnet, are you sure that your .profile is even getting sourced? This is a common problem in our environment when using Exceed.

If you login to Exceed, then manually source your .profile, what happens?

I am by no means a DBA, but what happens when you change this line: ORAENV_ASK=YES to ORAENV_ASK=NO.

Last edited by google; 09-01-2004 at 09:57 AM..
# 5  
Old 09-02-2004
I am manually sourcing this and it works. I thought I could do it the other way, but obviously not. Many thanks for your help. Changing ORAENV_ASK=NO will only change the way the SIDs are selected when listed, but the issue is with the line where it calls the executable.

I think I will stick with the manual sourcing. Thanks a lot for all your help.

Delboy.
# 6  
Old 09-02-2004
When logging into the system using Exceed, I dont think your .profile is being sourced.

In your /home directory, look for a hidden file called .dtprofile. In it, make sure that DTSOURCEPROFILE variable is set to TRUE.

We have had similar issues here at work (I use HPUX 11.). See if setting this variable works. (make sure its not commented out if it is already set to true!)

Example.
DTSOURCEPROFILE=true


Code:
Quote From This site 

Optionally Sourcing the .profile or .login Script
Xsession is able to source a user's traditional
HomeDirectory/.profile or HomeDirectory/.login scripts. By default
this capability is disabled. To tell Xsession to source the .profile 
or .login script, set DTSOURCEPROFILE to true.

To change DTSOURCEPROFILE for all users, create 
an /etc/dt/config/Xsession.d script that sets the new value. To 
set DTSOURCEPROFILE to true for all users, create an executable 
sh or ksh script, for example
/etc/dt/config/Xsession.d/myvars, and set DTSOURCEPROFILE as
follows:

DTSOURCEPROFILE=true

Users can similarly change DTSOURCEPROFILE for their own 
sessions by setting DTSOURCEPROFILE to true in 
HomeDirectory/.dtprofile.


Last edited by google; 09-02-2004 at 08:20 AM..
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Calling a script from master script to get value from called script

I am trying to call a script(callingscript.sh) from a master script(masterscript.sh) to get string type value from calling script to master script. I have used scripts mentioned below. #masterscript.sh ./callingscript.sh echo $fileExist #callingscript.sh echo "The script is called"... (2 Replies)
Discussion started by: Raj Roy
2 Replies

2. Shell Programming and Scripting

Calling shell script within awk script throws error

I am getting the following error while passing parameter to a shell script called within awk script. Any idea what's causing this issue and how to ix it ? Thanks sh: -c: line 0: syntax error near unexpected token `newline' sh: -c: line 0: `./billdatecalc.sh ... (10 Replies)
Discussion started by: Sudhakar333
10 Replies

3. Shell Programming and Scripting

calling a shell script present on another server using perl script.

Hi, I am working on a sever A. I want to write a perl script to execute a shell script persent on the server B. please help me in this. thanks in advance. (3 Replies)
Discussion started by: anandgodse
3 Replies

4. Shell Programming and Scripting

How we can pass the argument when calling shell script from perl script

Can someone let me know how could I achieve this In one of per script I am calling the shell script but I need to so one thing that is one shell script call I need to pass pne argument.In below code I am calling my ftp script but here I want to pass one argument so how could I do this (e.g:... (5 Replies)
Discussion started by: anuragpgtgerman
5 Replies

5. Shell Programming and Scripting

Calling a Perl script in a Bash script -Odd Situation

I am creating a startup script for an application. This application's startup script is in bash. It will also need to call a perl script (which I will not be able to modify) for the application environment prior to calling the application. The problem is that this perl script creates a new shell... (5 Replies)
Discussion started by: leepet01
5 Replies

6. Shell Programming and Scripting

Syntax error calling TCL script from shell script

hello everyone i am beginner on shell scripting .and i am working on my project work on ad hoc network i wrote a batch (.sh) to do a looping and execute a tcl script i wrote before in each iteration ..but i got this problem " syntax error near unexpected token `('... (1 Reply)
Discussion started by: marcoss90
1 Replies

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

8. Shell Programming and Scripting

How to return the value from the called shell script to the calling sh script

Hi all, I have two ksh scripts #sample1.sh #!/bin/ksh . ./sample2.sh echo $fileExist #sample2.sh #!/bin/ksh func() { i=1 return $a } func echo $? Here how should I return the value of sample2.sh back to sample1.sh? Thanks in advance. (2 Replies)
Discussion started by: gp_singh
2 Replies

9. Shell Programming and Scripting

passing a variables value from the called script to calling script using ksh

How do i get the value of the variable from the called script(script2) to the calling script(script1) in ksh ? I've given portion of the script here to explain the problem. Portion of Script 1 ============= ----- ----- tmp=`a.ksh p1 p2 p3` if then # error processing fi -----... (10 Replies)
Discussion started by: rajarkumar
10 Replies

10. UNIX for Advanced & Expert Users

calling a script from a level above where the script resides

is there anyway to call a script that executes a script on the same level from a higher level i.e. level1/level2/ kp1script kp2script kp1script (./kp2) kp2script (echo "Hi world") level1/level/2/level3/ ../kp1script ../kp1script: ./kp2script: not found cheers in advance (the... (2 Replies)
Discussion started by: SummitElse
2 Replies
Login or Register to Ask a Question