converting ksh to bash - typeset commands


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting converting ksh to bash - typeset commands
# 1  
Old 05-22-2012
Power converting ksh to bash - typeset, integer and @( 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

Code:
if [[ $inst = @(dev01|dev02) ]] && [[ `hostname` = wlgprod001 ]]; then
   continue
fi

Is there any site out there that discusses about converting ksh to bash and the gotchas?

Please advise how to get around this?

Last edited by newbie_01; 05-22-2012 at 04:03 AM.. Reason: More information added / Change title
# 2  
Old 05-22-2012
# 3  
Old 05-22-2012
Bug try this .....

Code:
echo "adfsddIfsfdDDDD" | tr '[a-z]' '[A-Z]'
ADFSDDIFSFDDDDD


Last edited by Franklin52; 05-22-2012 at 03:58 AM.. Reason: fixed code tags
# 4  
Old 05-22-2012
Modern bash:
Code:
$ a=dhTy
$ echo "${a^^}"
DHTY

This User Gave Thanks to Scrutinizer For This Post:
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

ksh "typeset -i" and Empty Parameters

I'm getting different behaviors for "typeset -i" on different systems. In one case unset parameters are 0, and in another case they're empty. Is one of these behaviors correct, or is the behavior here unspecified? First system: $ typeset -i x $ print $x 0 $ print ${.sh.version} Version M... (13 Replies)
Discussion started by: Matt Miller
13 Replies

2. Shell Programming and Scripting

Typeset conversion problem from ksh to bash

Hi, typeset -l sgf # all lowercase letters typeset -u SGF # all uppercase letters sgf=$1 SGF=$sgf these lines used in my scripts . It ran fine in ksh but when we convert this to bash it erroring out. I like to know what the use of typeset ?? Thanks & Regards kanagaraj (3 Replies)
Discussion started by: kanagaraj
3 Replies

3. Shell Programming and Scripting

Can BASH execute commands on a remote server when the commands are embedded in shell

I want to log into a remote server transfer over a new config and then backup the existing config, replace with the new config. I am not sure if I can do this with BASH scripting. I have set up password less login by adding my public key to authorized_keys file, it works. I am a little... (1 Reply)
Discussion started by: bash_in_my_head
1 Replies

4. 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

5. Shell Programming and Scripting

bash typeset padding with zeros

Hi everybody, I have a question about typesetting. I originally wrote a script for use with ksh and now I am on a system that I cannot modify, and it only has bash. In the original script I just did typeset -RZ4 variable and it would add the leading zeros. In bash, it doesn't work. I've... (2 Replies)
Discussion started by: jwheeler
2 Replies

6. Shell Programming and Scripting

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... (11 Replies)
Discussion started by: sherkaner
11 Replies

7. Shell Programming and Scripting

Help with typeset in bash

Hi everybody, hoping you can help. I'm trying to get some scripts working using bash which were written in ksh and I'm struggling with typeset. Specifically typeset -R and typeset -L. We need fixed length variables with left and right justification and bash does not seem to do it. Spent ages on... (5 Replies)
Discussion started by: Ian_H
5 Replies

8. 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

9. UNIX for Dummies Questions & Answers

typeset in Ksh

Hi, Most of times, I see use of typeset command in ksh scripts, but I don't know what it exactly does. I would be thankful if any body could provide me a brief explanation of typeset in ksh and all of its options, like typeset -A, typeset -r, typeset -Z, typetset -L etc. (5 Replies)
Discussion started by: nervous
5 Replies
Login or Register to Ask a Question