Quantcast
Channel: UNIX and Linux Forums
Viewing all articles
Browse latest Browse all 16232

Not able to understand IFS

$
0
0
Hi ,

i am in my initial learning phase of unix. i was going thru the function part.
below is the example which was there but i am not able to understand logic and the use of IFS(internal field separator)

Code:

lspath() {
OLDIFS="$IFS"
IFS=:
for DIR in $PATH ; do echo $DIR ; done
IFS="$OLDIFS"
}

the output is below. here i am failed to understand how the o/p is coming like below
and logic behind the IFS.

Code:

/sbin
/bin
/usr/bin
/usr/sbin
/opt/bin
/usr/ucb
/usr/ccs/bin
/usr/openwin/bin

regards,
scriptor

Viewing all articles
Browse latest Browse all 16232

Trending Articles