09-27-2007
converting ksh scripts to sh
Hello All,
I have a whole bunch of shell scripts written in a ksh environment and which successfully execute there. However, I found out that they eventually need to be used in a sh environment. So some commands like some_variable=$(some_command) fail because sh doesn't understand $(.....). I identified a list of scripts that have the $(.....) statements. Now I have to replace all those with `.....`
There must be someway I can automate this find and replace action right? Can you please point me in the right direction? Can I use sed for it? If so, what is the exact command? I can identify the statements using the regex '\$(.*)' but I don't know how to replace the command with `...`
I guess I have to parse each line of each file in a loop and do the substitution but I don't know the substituion command.
Thanks in advance for ur help.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
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
2. Shell Programming and Scripting
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
3. Windows & DOS: Issues & Discussions
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
4. Windows & DOS: Issues & Discussions
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
5. Shell Programming and Scripting
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
6. UNIX for Dummies Questions & Answers
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
7. Shell Programming and Scripting
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
8. Shell Programming and Scripting
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
9. UNIX for Dummies Questions & Answers
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
10. Shell Programming and Scripting
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
LEARN ABOUT DEBIAN
suspend
suspend(1) User Commands suspend(1)
NAME
suspend - shell built-in function to halt the current shell
SYNOPSIS
sh
suspend
csh
suspend
ksh
suspend
DESCRIPTION
sh
Stops the execution of the current shell (but not if it is the login shell).
csh
Stop the shell in its tracks, much as if it had been sent a stop signal with ^Z. This is most often used to stop shells started by su.
ksh
Stops the execution of the current shell (but not if it is the login shell).
ATTRIBUTES
See attributes(5) for descriptions of the following attributes:
+-----------------------------+-----------------------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+-----------------------------+-----------------------------+
|Availability |SUNWcsu |
+-----------------------------+-----------------------------+
SEE ALSO
csh(1), kill(1), ksh(1), sh(1), su(1M), attributes(5)
SunOS 5.10 15 Apr 1994 suspend(1)