Getting error while calling a script within a script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Getting error while calling a script within a script
# 1  
Old 10-07-2009
Getting error while calling a script within a script

Hi all,
I'm facing the following error while calling a script within a script,

/home/XXXX/.profile[21]: 0551-011: 0403-012 A test command parameter is not valid.
/home/XXXX/.profile[21]: test: 0403-004 Specify a parameter with this command.
stty: tcgetattr: A specified file does not support the ioctl system call.
stty: tcgetattr: A specified file does not support the ioctl system call.

----------------------------------------------------------------
The code will be looking like ,

The script a.sh contains,

#! /bin/sh
. /home/b.sh
exit



When i execute a.sh , i get the above error.


Kindly help me in this.

Thanks in advance.

-- Sri
# 2  
Old 10-07-2009
can you post the script b.sh?
# 3  
Old 10-07-2009
if you just want to call the script, no need of "."

Code:
. /home/b.sh

can be changed to

Code:
/home/b.sh

# 4  
Old 10-07-2009
thanks for the reply...

The script b.sh -> sets the env variables.

b.sh

#! /bin/sh

export LIBPATH=$ORACLE_HOME/lib:$MMHOME/oracle/lib/bin
export LINK_CNTRL=L_PTHREADS_D7
exit

--------------------------------------------------------------------

---------- Post updated at 02:33 PM ---------- Previous update was at 02:32 PM ----------

Yep ,
by removing "." it works, but the actual scripts are legacy scripts and they contain like
[. /home/b.sh ]

so need to find a way to run the script with that .
# 5  
Old 10-07-2009
This works just fine for me, in my environment -- bash in Debian..

Does this part is showing error, or some other part which you have truncated ?!
# 6  
Old 10-07-2009
My error is similar to the one listed in the
https://www.unix.com/unix-dummies-que...tr-errors.html
# 7  
Old 10-07-2009
Quote:
Originally Posted by sriniu190
The script b.sh -> sets the env variables.

b.sh

Please put code inside code tags.
Quote:
Code:
#! /bin/sh

    export LIBPATH=$ORACLE_HOME/lib:$MMHOME/oracle/lib/bin
    export LINK_CNTRL=L_PTHREADS_D7
exit

--------------------------------------------------------------------

---------- Post updated at 02:33 PM ---------- Previous update was at 02:32 PM ----------

Yep ,
by removing "." it works, but the actual scripts are legacy scripts and they contain like
[. /home/b.sh ]

so need to find a way to run the script with that .

Remove "exit" or replace it with "return".

Since a sourced script is run in the calling shell's process, exit will terminate the calling process.
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 Shell script Error

Hi All, I need to call a script in another server(Say B).So I logged in my local Machine(say A)using putty and given these command ssh root@hostname cd home\oracle sh script.sh. This is working perfectly.But when I have those command in a shell script and placed in my local... (2 Replies)
Discussion started by: Nivas
2 Replies

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

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

4. Shell Programming and Scripting

Error in calling a shell script from another script

HI, We are using two shell scripts, script.sh,env.sh, where env.sh will be called inside script.sh. The variable inside env.sh is used as $var in script.sh.But while running the script its not identifying that variable. Is there any permission needed to call a script inside another script. ... (3 Replies)
Discussion started by: banupriyat
3 Replies

5. Shell Programming and Scripting

Perl : Error in calling script

I am getting a strange error with perl's inbuilt script flush.pl. I am callling this script in my other script but it kept throwing error: flush.pl did not return a true value at ./abc.pl line 1 abc.pl has: require 'flush.pl'; Not sure why this error is coming. Can someone pls throw... (4 Replies)
Discussion started by: abhisharma23
4 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

Calling SQL script from ksh job and send mail on some error.

Hi, I am trying to call sql script from ksh job with parameters.The parameters passed from ksh job will be used in SELECT query in sql file to SPOOL the data in extract file.My questions are: 1) How to call a sql script from ksh job with parameters? 2) How to use the parameter in sql file to... (1 Reply)
Discussion started by: anil029
1 Replies

8. Shell Programming and Scripting

Error when calling sybase stored proc from shell script

Hi, I am writing a script that needs to call a stored proc which would update a column in a table based on a condition. I need to also capture the number of rows updated. However, When I execute the script I keep getting this error: ./test_isql.sh: syntax error at line 33: `end of file'... (3 Replies)
Discussion started by: karthikk
3 Replies

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

10. 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
Login or Register to Ask a Question