$IFS Internal Field Separator

Reserved / special variable that determines how the shell recognises field or word boundaries (i.e. the character that separates field or words) when it interprets strings.

 

$IFS defaults to whitespace (space, tab or newline) but can be changed, for example, to parse a csv file:

  • IFS=','
#! /bin/bash
clear

cities='New York':London:Paris:Munich
old_ifs="$IFS"           # Saving original value of IFS
IFS=":"
for place in $cities
do
      echo  $place
done
echo "Everybody talk about pop muzik"