The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM


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

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
bash. convert mpeg adts to normal mp3 stahoo23 Shell Programming and Scripting 5 05-18-2008 02:26 AM
what are some different commands in c shell and korn shell?? EquinoX UNIX for Dummies Questions & Answers 1 01-28-2008 09:14 PM
bourne shell or korn shell? XZOR UNIX for Dummies Questions & Answers 2 10-05-2006 11:34 PM
How to Convert scientific notation to normal ? maheshsri Shell Programming and Scripting 2 01-05-2006 10:33 AM
KORN Shell - Spawn new shell with commands frustrated1 Shell Programming and Scripting 2 04-20-2005 11:23 AM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 11-22-2005
Registered User
 

Join Date: Sep 2005
Posts: 74
how to convert from korn shell to normal shell with this code?

well i have this code here..and it works fine in kornshell..

#!/bin/ksh
home=c:/..../
input=$1
sed '1,3d' $input > $1.out

line=""
cat $1.out | while read a
do
line="$line $a"
done

echo $line > $1

rm $1.out

however...now i want it just in normal sh mode..how to convert this? any help? thanks!
Reply With Quote
Forum Sponsor
  #2  
Old 11-22-2005
vgersh99's Avatar
Moderator
 

Join Date: Feb 2005
Location: Boston, MA
Posts: 3,016
Quote:
Originally Posted by forevercalz
well i have this code here..and it works fine in kornshell..

#!/bin/ksh
home=c:/..../
input=$1
sed '1,3d' $input > $1.out

line=""
cat $1.out | while read a
do
line="$line $a"
done

echo $line > $1

rm $1.out

however...now i want it just in normal sh mode..how to convert this? any help? thanks!
could you define what you mean by 'normal' sh, pls?

and if you had run it under your 'normal' sh, what kind of issue you encountered?
Reply With Quote
  #3  
Old 11-22-2005
Registered User
 

Join Date: Sep 2005
Posts: 74
oh its bourne shell as in #!/bin/sh
Reply With Quote
  #4  
Old 11-22-2005
vgersh99's Avatar
Moderator
 

Join Date: Feb 2005
Location: Boston, MA
Posts: 3,016
Quote:
Originally Posted by forevercalz
oh its bourne shell as in #!/bin/sh
ok, so. when you run it under '/bin/sh' ... what's taking place?
Reply With Quote
  #5  
Old 11-22-2005
Registered User
 

Join Date: Sep 2005
Posts: 74
well....its this part i guess...or maybe other part of the lines...as im a newbie..what i think was this line that cause the error....
cat $1.out | while read a
do
line="$line $a"
done

the line will not combine...as in the code here "$line Sa" will not execute
Reply With Quote
  #6  
Old 11-22-2005
vgersh99's Avatar
Moderator
 

Join Date: Feb 2005
Location: Boston, MA
Posts: 3,016
Quote:
Originally Posted by forevercalz
its this part i guess...
cat $1.out | while read a
do
line="$line $a"
done

the line will not combine...as in the code here "$line Sa" will not execute
what do you get as the output?

could you post the content of your '$1' file, pls?
Reply With Quote
  #7  
Old 11-22-2005
Registered User
 

Join Date: Sep 2005
Posts: 74
ok..my output was something similar to this..
abc

abc

abc

and when i run this ...i will get
abc abc abc...

i can get this in korn shell ..but not in bourne..dun know why,,
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 02:16 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0