Skip to main content
Commonmark migration
Source Link
  1. Echo is putting newlines between words because it's splitting the input at the spaces, not at the newline.

  2. This is also why the eval doesn't work - it sees the first word, containing a ', and doesn't see the end of the line, which contains the closing '

###Solution:

Solution:

Change the value of IFS (Internal Field Separator) to not contain spaces or tabs, but just newlines. You do it like this:

IFS=$'\n'

before you start reading in the file.

  1. Echo is putting newlines between words because it's splitting the input at the spaces, not at the newline.

  2. This is also why the eval doesn't work - it sees the first word, containing a ', and doesn't see the end of the line, which contains the closing '

###Solution:

Change the value of IFS (Internal Field Separator) to not contain spaces or tabs, but just newlines. You do it like this:

IFS=$'\n'

before you start reading in the file.

  1. Echo is putting newlines between words because it's splitting the input at the spaces, not at the newline.

  2. This is also why the eval doesn't work - it sees the first word, containing a ', and doesn't see the end of the line, which contains the closing '

Solution:

Change the value of IFS (Internal Field Separator) to not contain spaces or tabs, but just newlines. You do it like this:

IFS=$'\n'

before you start reading in the file.

Source Link
Jenny D
  • 13.3k
  • 3
  • 42
  • 55

  1. Echo is putting newlines between words because it's splitting the input at the spaces, not at the newline.

  2. This is also why the eval doesn't work - it sees the first word, containing a ', and doesn't see the end of the line, which contains the closing '

###Solution:

Change the value of IFS (Internal Field Separator) to not contain spaces or tabs, but just newlines. You do it like this:

IFS=$'\n'

before you start reading in the file.