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

What does path stand for?

0 Answers  


How to write an Auto scripting for deleting old files using shell script and made a cron job to run on daily basis

1 Answers  


Why is used in shell scripting?

0 Answers  


How will you emulate wc –l using awk?

0 Answers  


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

0 Answers  






What is a shell environment?

0 Answers  


How do I edit a .sh file?

0 Answers  


Is shell and terminal the same?

0 Answers  


What is shell and shell script?

0 Answers  


How to debug the problems encountered in the shell script/program?

0 Answers  


Why do we write bin bash in shell scripts?

0 Answers  


What is an sh file?

0 Answers  


Categories