Switching shells in UNIX Scripts

Solaris

Newbie here to scripting in UNIX/SOLARIS.
What I am looking to do is, once the script is
executed, switch to /bin/bash shell and continue
to execute the script.

The problem I run into is once the script switches to the Bash
shell, the script stops, and does not execute the remainder of the script.

Script looks like:

clear
/bin/bash to switch to Bash shell

Then the remaider of the script to execute

Anyone know how I can switch shells in a script and still have the script execute the lines below the switch?

:confused:

I doubt you can switch the shell in the middle of a script.

Why do you want to switch ?

the shells have similiar constructs save for a few ones.

Anyway, you can compile the second part of the script as a new script which runs in bash and invoke that.

#! /bin/ksh
# commands 
# which 
# runs 
# in 
# the 
# ksh 
# shell
#
. ./script-that-requires-bash

where

script-that-requires-bash is

#! /bin/bash
# commands 
# which 
# runs 
# in 
# the 
# bash
# shell

If you export any variables in the ksh script, there is a chance that the inner script might not be able to see it. It depends on the way you invoke the ksh script.

Thanks for the tip.
Reason for going to Bash is because if I don't I get errors using
wildcard (*) with the gzip command...not sure why...