how to convert from korn shell to normal shell with this code?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting how to convert from korn shell to normal shell with this code?
# 1  
Old 11-22-2005
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!
# 2  
Old 11-22-2005
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?
# 3  
Old 11-22-2005
oh its bourne shell as in #!/bin/sh
# 4  
Old 11-22-2005
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?
# 5  
Old 11-22-2005
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
# 6  
Old 11-23-2005
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?
# 7  
Old 11-23-2005
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,,
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

HELP on Perl array / sorting - trying to convert Korn Shell Script to Perl

Hi all, Not sure if this should be in the programming forum, but I believe it will get more response under the Shell Programming and Scripting FORUM. Am trying to write a customized df script in Perl and need some help with regards to using arrays and file handlers. At the moment am... (3 Replies)
Discussion started by: newbie_01
3 Replies

2. Shell Programming and Scripting

Bourne shell & Korn shell

Could some one tell me the difference btw Bourne shell and the Kshell? Which is more flexible and reliable in terms of portability and efficiency. When i type the following command .. $ echo $SHELL yields me /bin/sh Does this tells me that I am in Bourne shell. If yes, how can i get... (6 Replies)
Discussion started by: bobby1015
6 Replies

3. Shell Programming and Scripting

convert perl code to shell script

This is about how to Monitoring folder for new files using shell script im doing a project using smsserver tools 3. i have used a perl script to handle incoming messages. the content of each message must be directed to a java program. this program generates the answer to reply to the user... (2 Replies)
Discussion started by: x34
2 Replies

4. Shell Programming and Scripting

How to activate Korn Shell functionnalities in Bourne Shell

Hi All I have writing a Korn Shell script to execute it on many of our servers. But some servers don't have Korn Shell installed, they use Borne Shell. Some operations like calculation don't work : cat ${file1} | tail -$((${num1}-${num2})) > ${file2} Is it possible to activate Korn Shell... (3 Replies)
Discussion started by: madmat
3 Replies

5. Shell Programming and Scripting

Code coverage for Korn shell

hi can anyone suggest how to check the code coverage of the shell script (ksh). also i do not see any man page for shcov. what does shcov do.? please help. (1 Reply)
Discussion started by: anijan
1 Replies

6. Shell Programming and Scripting

how can i call one korn shell from a shell

Hi guys, please help me I have a ksh script (second picture down), in that script I define the function DATECALC. Now I want to use this function KSH in a program shell. How can I call this ksh from my shell program? My shell program is... in the first two lines I tried to call... (1 Reply)
Discussion started by: acevallo
1 Replies

7. UNIX for Dummies Questions & Answers

what are some different commands in c shell and korn shell??

I am doing this simple script using c shell and korn shell. The commands I use are fgrep , ls, and also some redirecting. Is there any difference in using both of these commands in c shell and korn shell? Thanks and sorry for the stupid question. (1 Reply)
Discussion started by: EquinoX
1 Replies

8. AIX

tsh shell to korn shell

i got stuck in IBM AIX unix and i was googling for the answer. but i didn't find one. can anyone tell me how to get back from tsh# shell to korn shell my system is showing tsh shell in the terminal but i am unable to get back to korn shell. i tried chsh, shell, su, logout, exit commands but not 1... (7 Replies)
Discussion started by: arifkhan
7 Replies

9. UNIX for Dummies Questions & Answers

bourne shell or korn shell?

Hi, I have a script that uses "nohup" command to execute a korn shell script. Which one is the correct shell to use bourne shell or korn shell to execute a korn shell? and why? Thanks in advanced. (2 Replies)
Discussion started by: XZOR
2 Replies

10. Shell Programming and Scripting

KORN Shell - Spawn new shell with commands

I want to be able to run a script on one server, that will spawn another shell which runs some commands on another server.. I have seen some code that may help - but I cant get it working as below: spawn /usr/bin/ksh send "telnet x <port_no>\r" expect "Enter command: " send "LOGIN:x:x;... (2 Replies)
Discussion started by: frustrated1
2 Replies
Login or Register to Ask a Question

Featured Tech Videos