Hi, all Scripting professional.
Q. I have written script1.sh and calling script2.sh in
script1.sh file using bash shell as interpreter and my log
in shell also bash shell.My code like
Script1

#!/bin/bash
echo "My script2 call"
. script2.sh

Here script2.sh file run successfully but when I have
changed my interpreter bash to ksh like #!/bin/ksh
Error are comming script2.sh command not found. Guid me how
to call other script in our main script.

Answers were Sorted based on User's Feedback



Hi, all Scripting professional. Q. I have written script1.sh and calling script2.sh in script1.sh..

Answer / deep

instead of

. script2.sh

Just try

sh script2.sh

It will Run

Is This Answer Correct ?    1 Yes 0 No

Hi, all Scripting professional. Q. I have written script1.sh and calling script2.sh in script1.sh..

Answer / jitesh varshney

write code like this :

#!/bin/bash
echo "My script2 call"
/bin/bash ./script2.sh [ or /bin/ksh ./script2.sh ]

It will run ..... enjoy !!!!!!

Is This Answer Correct ?    1 Yes 0 No

Post New Answer

More Shell Script Interview Questions

write a scwipt that a) takes exactly one argument, a directory name. b) if the number of argument is more or less than one,print a usage message c) if the argument is not adirectory, print another message d) for the given directory, print the five biggest files and the five files that were most recently modified. e) save the output to a file called q2output.

2 Answers  


What is awk in shell script?

0 Answers  


I have to write Shells (Linux + Unix)for publishing packages and reports. Is it possible ? What are the differents executable programs ineed to call ?

0 Answers  


What is the use of "test" command?

2 Answers  


I want to monitor a continuously updating log file, what command can be used to most efficiently achieve this?

0 Answers  


How u convert string "hi pravin how are you?" to "Hi Pravin How Are You?"

12 Answers   Cap Gemini,


What is sh in shell script?

0 Answers  


What is scripting autism?

0 Answers  


Explain about debugging?

0 Answers  


Why is it called a shell?

0 Answers  


What is the conditional statement in shell scripting?

0 Answers  


How Connect to a Database in Shell Programming?

4 Answers   Syntel,


Categories