Operating System - HP-UX
1848010 Members
8700 Online
104022 Solutions
New Discussion

multiple shell command interpreter on script....

 
SOLVED
Go to solution
John Joaquin
Occasional Contributor

multiple shell command interpreter on script....

guys,

I'm planning to create a large shell script but it require multiple language/module such as expect & perl within the ksh... Should i put any extra expression on the header of my script....
2 REPLIES 2
Patrick Wallek
Honored Contributor
Solution

Re: multiple shell command interpreter on script....

No, you can only have one she-bang at the top of the script.

Your best bet would be to call other scripts from within the main script.

For example:

# cat mainscript.sh
#!/usr/bin/sh

...Do some stuff...
/dir/script.expect
...Do some other stuff...
/dir/script1.perl
...Do some more stuff...

# cat script.expect
#!/path/to/expect
Do some expect stuff......

# cat script1.perl
#!/path/to/perl
Do some perl stuff.....
Vibhor Kumar Agarwal
Esteemed Contributor

Re: multiple shell command interpreter on script....

Will something like this help:

echo task1 | sh
#To be executed by sh
echo task2 | bash
#To be executed by bash
echo task3 | ksh
#To be executed by korn shell
Vibhor Kumar Agarwal