Struck with Typeset Command

Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Struck with Typeset Command
# 1  
Old 06-13-2011
Struck with Typeset Command

Can someone explain whats this below command will do exactly..

typeset tmpFile1 tmpDir1 rc fileName fullName bc

typeset tmpFile1 tmpFile2 rc fileSuffix uef
typeset origFile bc fullName tmpDir1 remoteCmd inFile newInFile
typeset num fn curDate fileSuffix ucFileName

Since i'm new to scripting, i'm struck with this
# 2  
Old 06-13-2011
That form of typeset is used to declare local variables inside a function. Like this
$ cat ts
#! /bin/ksh

function one
        typeset xyz
        echo in function one xyz = $xyz

echo in main xyz = $xyz
echo in main xyz still = $xyz
exit 0
$ ./ts
in main xyz = 1
in function one xyz = 12
in main xyz still = 1

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Struck at shell command

Can someone help me to get two different outputs mentioned in code tags. Input: user=alexander user=james user=kelly (5 Replies)
Discussion started by: buzzme
5 Replies

2. Shell Programming and Scripting

Typeset command issue

Hi, As per my understanding typeset wil lmake a variable constant or readonly and -i option will make a variable integer. But please see the below outputs typeset -i abc=000001;echo $abc 1 typeset -i abc=0000010;echo $abc 8 typeset -i abc=00000100;echo $abc 64 typeset -i... (3 Replies)
Discussion started by: ratheeshjulk
3 Replies

3. Shell Programming and Scripting

Why use typeset?

Hi, All the scripts we have here use typeset instead of normal variables. They don't have any parameters, they just get declared at the beginning of the scripts like this: typeset var1 var2 var3Could anyone tell me why this is done? I don't see the advantage in this over using normal variables. (1 Reply)
Discussion started by: Subbeh
1 Replies

4. Shell Programming and Scripting

how the typeset command works in shell script

typeset -l section section=${2:-.} what does these 2 lines meaning? (1 Reply)
Discussion started by: venkatababu
1 Replies

5. Shell Programming and Scripting

Error while using typeset command

I am having a problem with typeset command: It is behaving differently in different machines. Machine 1: /marc_data/marc_project/owb_marc_adaptor/owb_marc_adaptor_load/bin>echo $0 -bash /marc_data/marc_project/owb_marc_adaptor/owb_marc_adaptor_load/bin>vi fn2.ksh... (6 Replies)
Discussion started by: boopathyvasagam
6 Replies

6. UNIX for Dummies Questions & Answers


Hi, Can any one please explain me the use of 'typeset' in shell scripting? I donot under stand the use and advantages of using typeset. In one of our script, it is written like typeset VERBOSE NO_UPDATE typeset LOAD_SYBASE_TABLES I donot understand what actually these lines do. As per my... (2 Replies)
Discussion started by: siba.s.nayak
2 Replies

7. Shell Programming and Scripting

Awking!! Printing decimal output is struck

Hi friends, I have a small problem with AWK. I am not able to print decimal values! :confused: below is my code: #! /bin/awk -f awk BEGIN{printf("%d",123)}; -> This prints the integer properly. x=111 awk BEGIN{printf("%d",x)}; -> This doesnt print! :( Please help me solve this. It... (4 Replies)
Discussion started by: divzz
4 Replies

8. UNIX and Linux Applications


Hi All , Can any one help me the meaning of typeset -r Thanks, venkat (1 Reply)
Discussion started by: venkatakotiy
1 Replies

9. Shell Programming and Scripting


Hi, Could any one please explain about typeset or share any link from where i can study about typeset i.e how to use it, how to define it.. etc? Thanks- Yogi (3 Replies)
Discussion started by: bisla.yogender
3 Replies

10. UNIX for Dummies Questions & Answers

typeset and export command difference

Can anyone please explain what the difference is between these two commands typeset - ? export - i know with this even child process can read the variable Declare - ? i use bash shell states that " The typeset command is... (0 Replies)
Discussion started by: systemsb
0 Replies
Login or Register to Ask a Question