About 50 results
Open links in new tab
  1. What is the meaning of IFS=$'\\n' in bash scripting?

    Feb 15, 2015 · At the beginning of a bash shell script is the following line: IFS=$'\\n' What is the meaning behind this collection of symbols?

  2. What is the "IFS" variable? - Unix & Linux Stack Exchange

    Feb 20, 2023 · I was reading this Q&A: How to loop over the lines of a file? What is the IFS variable? And what is its usage in the context of for-loops?

  3. Understanding "IFS= read -r line" - Unix & Linux Stack Exchange

    Jun 12, 2015 · Using IFS= LC_ALL=C read -r line works around it there. Using var=value cmd syntax makes sure IFS / LC_ALL are only set differently for the duration of that cmd command. History note …

  4. shell - Understanding IFS - Unix & Linux Stack Exchange

    The following few threads on this site and StackOverflow were helpful for understanding how IFS works: What is IFS in context of for looping? How to loop over the lines of a file Bash, read line by...

  5. For loop over lines -- how to set IFS only for one `for` statement?

    Jul 9, 2021 · Here is an example of behavior I want to achieve: Suppose I have a list of lines, each line containing space separated values: lines='John Smith James Johnson' And I want to loop over lines …

  6. understanding the default value of IFS - Unix & Linux Stack Exchange

    Here if the expansion contains any IFS characters, then it split into different 'words' before the command is processed. Effectively this means that these characters split the substituted text into different …

  7. Why is `while IFS= read` used so often, instead of `IFS=; while read..`?

    The IFS= read -r line sets the environment variable IFS (to an empty value) specifically for the execution of read. This is an instance of the general simple command syntax: a (possibly empty) sequence of …

  8. Bash script: performance comparison of file reading methods

    May 14, 2025 · In almost every case, you should not read a file line-by-line using a shell loop at least not as your first instinct. Often when someone uses a line-by-line loop in shell, what they actually need is …

  9. Using curly braces to process colon-separated variables

    Apr 26, 2025 · ¹ Though note that it splits ::a:b::c::: into a, b and c only like IFS-splitting did in the Bourne shell (but not in modern Bourne-like shells except when space, tab or newline are used as separators).

  10. bash - Can IFS (Internal Field Separator) function as a single ...

    Parsing an array using IFS with non-whites space values creates empty elements. Even using tr -s to shrink multiple delims to a single delim isn't enough. An example may explain the issue more clea...