Search code examples
ifs

Hi what is the meaning of IFS with single quote in next line?


Hi IFS=' ' is for space, but what is

IFS='
'

Solution

  • It means you are specifying the IFS to use newline for splitting. This would be similar to doing:

    IFS=$'\n'
    

    The difference being is that your way is POSIX compliant.

    My sources for this answer are here and here

    You may find that the different methods are preferred depending on which shell implementation you are using (I think that's the right term?)


    NOTE: My answer is based purely on the last 10 minutes of research, I have no prior experience or knowledge with this.