converting ksh scripts to sh


Login or Register for Dates, Times and to Reply

 
Thread Tools Search this Thread
# 8  
Quote:
Originally Posted by sherkaner
However, the scripts are for the 'production system' which apparently does not have ksh
What shells does it have?

Check for combinations of /bin/bash, /usr/bin/ksh, /usr/local/bin/ksh, /bin/zsh etc?
# 9  
porter, I'm just a shell programmer working on the project on a need to know basis, unfortunately. The higher ups do not want to make any compromises on the production system, so they instructed me to change the $(...) statements. I guess I can write a small line parser in C that will do the job. Its all I can come up with for the moment. I'm sure there are much easier, better solutions for the subsitution but i don't know of any. maybe perl or ruby (both of which I do not know). I'll consult with my tech lead...perhaps i can catch hold of him.
# 10  
/usr/xpg4/bin/sh

will allow $( ) and other POSIX constructs, it is probable that that will be installed, while it will not completely remedy your situation it might reduce the amount of work you need to do.
# 11  
Quote:
Originally Posted by sherkaner
The higher ups do not want to make any compromises on the production system.
...but are happy to put hurried/untested scripts on? How are you going to regression test, do you have a pre-prod system that similarly doesn't have ksh on it?
# 12  
Thanks for the insight and advice porter. Apparently they don't have the xpg4 sh (the scripts simply didn't work in the system). These scripts haven't been tested yet. Someone from testing did rudimentary testing and discovered that the scripts don't work. Now I've got to rectify it. Perhaps, I'll use some start-from-scratch logic like this..

In the algorithm below,
'conv' is used count number of $(..) to convert.
Not sure, if regular parantheses these ever occur (just plain '(....)') . Just realized this. I am not accounting for them. But let me know if you know that regular parathesis do occur. As far as i know i am not using grep statements searching for regular paranthesis in the scripts)

For each file from list of files.
do

Move file to file_ksh

For each line in file_ksh
do


For each character in line
do

if char is $,
if next char is (
conv = conv + 1
replace_char = `
else if char is ) and conv != 0
replace_char = `
conv = conv - 1
else
replace_char=char

Write replace character into line_variable.
done

write line_variable into file

done

done

How does this sound?? I know that its roundabout but I dont know any other way. Thanks.
Login or Register for Dates, Times and to Reply

Previous Thread | Next Thread
Thread Tools Search this Thread
Search this Thread:
Advanced Search

Test Your Knowledge in Computers #328
Difficulty: Easy
The Windows ME operating system was released in the year 2006.
True or False?

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

converting ksh to bash - typeset commands

Hi all, Am trying to convert a script written in ksh to a bash shell. At the moment, am stumped with the typeset -u command and I can't find an equivalent of it in bash. integer function is also not working as is the following if statement if ] && ]; then continue fi Is... (3 Replies)
Discussion started by: newbie_01
3 Replies

2. UNIX for Dummies Questions & Answers

converting scripts from dos 2 unix format

Hi, I am new to shell scripting and exploring it , I have developed few sample shell script but I have developed them on windows xp notepad and then saving them on folder and then testing them on cywgin and running perfectly...but these scripts are in dos format and I want to convert them in unix... (1 Reply)
Discussion started by: rahul125
1 Replies

3. Shell Programming and Scripting

KSH - How to call different scripts from master scripts based on a column in an Oracle table

Dear Members, I have a table REQUESTS in Oracle which has an attribute REQUEST_ACTION. The entries in REQUEST_ACTION are like, ME, MD, ND, NE etc. I would like to create a script which will will call other scripts based on the request action. Can we directly read from the REQUEST_ACTION... (2 Replies)
Discussion started by: Yoodit
2 Replies

4. Shell Programming and Scripting

KSH script to run other ksh scripts and output it to a file and/or email

Hi I am new to this Scripting process and would like to know How can i write a ksh script that will call other ksh scripts and write the output to a file and/or email. For example ------- Script ABC ------- a.ksh b.ksh c.ksh I need to call all three scripts execute them and... (2 Replies)
Discussion started by: pacifican
2 Replies

5. UNIX for Dummies Questions & Answers

Converting binary file to readable format in Ksh

In Unix/Ksh, when I try to look inside a file it says that the file may be a binary file and if I want to see it anyway. When i say 'yes', it shows me the content filled with unreadable symbols (looks like binary). Is there a command that I can run from the Unix prompt to convert/translate that... (3 Replies)
Discussion started by: arthurs
3 Replies

6. Shell Programming and Scripting

HELP WITH .ksh script converting the exit status

Hi Can someone help me please? In a standard UNIX .ksh script, if you have the exit status..say 5...what line do you have to enter into the script for this number to be automatically converted to its actual exit reason by looking up the exit status file...wherever that is? thanks angus (1 Reply)
Discussion started by: angusyoung
1 Replies

7. Windows & DOS: Issues & Discussions

converting ksh scripts--.bat in window's

hi evry one , I did some ksh scripts for file editing in AIX 5.2 ver, issue is while I was trying to run these scripts in windows box as batch files windows is not recognising the awk part of the ksh script,as it is GNU environment, so any one who can help me will be appreciated. this is the... (3 Replies)
Discussion started by: 2.5lt V8
3 Replies

8. Windows & DOS: Issues & Discussions

Converting UNIX scripts to DOS

Is there a tool available to convert UNIX (BASH Shell) scripts to DOS scripts? I understand that DOS scripting is far inferior to unix scripting, and therfore this conversion may not be possible. Alternativley, perhaps I could convert my Unix scripts to C... then compile it for a windows... (2 Replies)
Discussion started by: Crozz
2 Replies

9. Shell Programming and Scripting

Converting Text File into XML using Unix Shell Scripts

Hi everyone, If someone out there could help me out with this problem. I would really appreciate it. I am trying to convert a file into xml format using Unix shell scripts. The file has fields with each field having a certain number of bytes, but the fields are not delimited by anything... (10 Replies)
Discussion started by: Laud12345
10 Replies

10. Shell Programming and Scripting

Converting an OpenVms .com to a UNIX ksh script

Does anyone know what a unix equivalent to the following OpenVms string would be? variable1 = F$FAO("!123AS",file_create_time) I can't seem to find the proper syntax of anything I try. Thx! J (1 Reply)
Discussion started by: prosserj
1 Replies

Featured Tech Videos