BASH to KSH | Unix Linux Forums | Shell Programming and Scripting

  Go Back    


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

BASH to KSH

Shell Programming and Scripting


Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 08-30-2011
cvsanthosh cvsanthosh is offline
Registered User
 
Join Date: Aug 2011
Last Activity: 27 March 2014, 2:27 AM EDT
Posts: 13
Thanks: 5
Thanked 0 Times in 0 Posts
BASH to KSH

I have a script in KSH and now need to incorporate this into another script which is in BASH. OUr script contains code like below in good number of places.

Eg: echo A B C | read VAR1 VAR2 VAR3

This works only in ksh and not in BASH. Please let me know

1. Which is the equivalent of the above in BASH.
Or
2. Is it possible to switch from BASH to KSH with in the same script so that our code works fine.

Looking for your help as we are in a critical stage. THanks a lot in advance.
Sponsored Links
    #2  
Old 08-30-2011
psshah psshah is offline
Registered User
 
Join Date: Jan 2009
Last Activity: 12 July 2012, 4:59 PM EDT
Posts: 55
Thanks: 5
Thanked 5 Times in 5 Posts
At the start of both scripts, let them know how they should run i.e. interpreter.
For bash, put first line as #!/bin/bash
Write down your logic.
Call ksh script.
In ksh script, put first line as #!/bin/ksh
Once ksh exits, control will be regained by bash.

Note: Location of ksh and bash can vary depending upon system.
You need to study further, if scripts are passing data to each other.

It would be better if you provide complete flow with code (if feasible).
Sponsored Links
    #3  
Old 08-30-2011
cvsanthosh cvsanthosh is offline
Registered User
 
Join Date: Aug 2011
Last Activity: 27 March 2014, 2:27 AM EDT
Posts: 13
Thanks: 5
Thanked 0 Times in 0 Posts
Thanks for your reply. We need to change from BASH to KSH with in the same script. Reason being some of the environment related settings are done using BASH.
    #4  
Old 08-30-2011
yazu yazu is offline
Registered User
 
Join Date: Jun 2011
Last Activity: 25 May 2014, 1:25 AM EDT
Location: From far
Posts: 987
Thanks: 21
Thanked 232 Times in 226 Posts
1. read VAR1 VAR2 VAR3 <<<$(echo A B C)
2. No
Sponsored Links
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Bash Script: modify bash LibRid Shell Programming and Scripting 9 10-25-2010 06:17 PM
bash preferred or ksh with bash features mrwatkin UNIX for Dummies Questions & Answers 2 06-17-2009 01:19 PM
how to make your bash script run on a machine with csh and bash npatwardhan Shell Programming and Scripting 3 11-19-2008 03:17 AM
bash and ksh: variable lost in loop in bash? estienne Shell Programming and Scripting 2 08-25-2008 02:09 PM
passing variable from bash to perl from bash script arsidh Shell Programming and Scripting 10 06-04-2008 12:25 PM



All times are GMT -4. The time now is 01:12 AM.