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

    Jul 20, 2016 · The default value for IFS consists of whitespace characters (to be precise: space, tab and newline). Each character can be a word boundary. So, with the default value of IFS, …

  2. 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 …

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

    Jun 12, 2015 · IFS is the Input Field Separator, which means the string read will be split based on the characters in IFS. On a command line, IFS is normally any whitespace characters, that's …

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

    Feb 20, 2023 · The default value of IFS is space, tab and newline, so if foo prints out two lines hello world and howdy then the loop body is executed with x=hello, then x=world and …

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

    Aug 17, 2011 · 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 …

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

    As Stephane points out below, the order of characters within IFS is significant when expanding "$*". From the bash man page: "$*" is equivalent to "$1c$2c...", where c is the first character of …

  7. '\n' in `IFS=$'\n' is a variable? - Unix & Linux Stack Exchange

    Oct 26, 2018 · ifs=' ' which is equivalent but harder to read. BTW: This extension already has passed the POSIX standard commitee, but it is scheduled for SUSv8 that is expected to …

  8. How to send a command with arguments without spaces?

    Mar 15, 2017 · Consecutive separator characters that are whitespace are treated as a single separator, so the result of the expansion of cat${IFS}file.txt is two words: cat and file.txt. Non …

  9. 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 …

  10. problem with IFS - The UNIX and Linux Forums

    Dec 22, 2006 · Hi, This is out of curiosity: I wanted to extract year, month and date from a variable, and thought that combining read and IFS would help, but this doesn't work: echo …

Refresh