resetting IFS variable


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting resetting IFS variable
# 1  
Old 03-27-2008
resetting IFS variable

Hi,
I have modified the IFS variable in the K shell program and with in the program i want to reset to the default one. How do i reset the same.

e.g

in the begining of the program IFS is default

in the middle i changed it to
IFS="|"

and again i want the default value for the IFS.

Please reply.

Thanks
Vijay
# 2  
Old 03-27-2008
The standard way to do this is to simply save the old value so you can restore it later. The user could have set it to whatever for various reasons.

Code:
OLDIFS=$IFS
IFS='(-:'
: ... code ...
IFS=$OLDIFS

# 3  
Old 03-27-2008
Thanks

Thanks a lot...
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Odd Behaviour for Set and IFS variable

Ok, so I'm playing around with delimters and reading files. and I came across this behaviour that I thought was a bit odd, regarding how the set command takes values... If I run this: IFS=$'-' #Assigns the - as the default delimiter for bash set I-love-my-gf-a-lot #uses set to put a bunch of... (1 Reply)
Discussion started by: Lost in Cyberia
1 Replies

2. AIX

Resetting the NVRAM

Does anybody know how to reset the NVRAM on a System p 520 (power 5)? (7 Replies)
Discussion started by: livehho
7 Replies

3. Solaris

Resetting ALOM

Hi gurus, I have a sun netra 240 server. I want to get to the ALOM but it always ask for login and password. Can anyone tell me how I can reset the ALOM it to default so I can be able to configure it? Thanks lots. (2 Replies)
Discussion started by: cjashu
2 Replies

4. Shell Programming and Scripting

Resetting date

Hi there, Is there a way i can reset the date on my unix terminal to yesterday's date? date Tue Jul 1 14:18:21 GMT 2008 Please let me know. JAK (7 Replies)
Discussion started by: jakSun8
7 Replies

5. Shell Programming and Scripting

Confusion about IFS Variable

================================================= #!/bin/sh HOST=eux091 if && grep -q $HOST /etc/maestab then IFS=: grep -v -e "^#" -e "^$" /etc/maestab | grep $HOST | \ read HOST MAESTRO_BIN FLAG MAESTRO_USER echo $MAESTRO_BIN MAESTRO_HOME=`dirname $MAESTRO_BIN`... (7 Replies)
Discussion started by: Awadhesh
7 Replies

6. Solaris

Resetting user's passwords

Hi all, I'm developing a script to handle the various actions involved with user admin as root: Reset password create a new users change a users email address, etc We're in the process of changing over from "telnet" to "SSH" to establish terminal sessions on our Solaris 9/10 servers. ... (2 Replies)
Discussion started by: dewets
2 Replies

7. UNIX for Dummies Questions & Answers

IFS variable

How can I set the value for IFS variable (2 Replies)
Discussion started by: mahabunta
2 Replies

8. UNIX for Dummies Questions & Answers

the IFS variable

Hi all, Ok os heres my situation. I have created a database style program that stores a persons info (name,address,phone number etc.) in a file ("database"). after i read in all the values above, i assign them to a line variable: line="$name^$address^$phonenum" >> phonebuk as you can see... (1 Reply)
Discussion started by: djt0506
1 Replies

9. Shell Programming and Scripting

IFS changing the variable value

Hi, I have a while read loop that reads files in a directory and process. The files have spaces in between, so I have the IFS=\n to to read the whole line as one file name. The read works fine but I have a problem with another variable that I set in the beginning of the script. The variable... (1 Reply)
Discussion started by: pvar
1 Replies

10. UNIX for Dummies Questions & Answers

Resetting WTMP?

When I type last oracle I get dates from Nov 28, 2000 all the way back to the beginning of time it seems. The 11-28-2000 entry states that Oracle is still logged in, but if you type a who, it shows only 1 entry - the currently logged in user (Me as oracle), but I logged in only minutes ago - and... (4 Replies)
Discussion started by: cuppjr
4 Replies
Login or Register to Ask a Question