Hacker News new | past | comments | ask | show | jobs | submit login

In a POSIX shell, I actually prefer to use the bell character for IFS.

  while IFS="$(printf \\a)" read -r field1 field2...
  do ...
  done
This works just as well as anything outside the range of printing characters.

Getting records that contain newlines would be a bit trickier.




Heaven help you if you cat the file in a shell, though!


I think IFS=$'\a' works too.


Only in bash and possibly other shells that extend the POSIX syntax, not in the basic POSIX standard.


I seem to remember something about dash adding that functionality.

...I found it - the question is under review by the Austin group for inclusion in POSIX.

https://austingroupbugs.net/view.php?id=249




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: