<div class="news_item">#276<div class="news_title">BASH for-loop split on newline
Posted by dandriff on Sunday June 29, 2008@10:43AM
Howto: Coax a BASH shell script into splitting for-loop elements by newline instead of whitespace (whitespace is the default behaviour). #!/bin/bash IFS_BAK=$IFS IFS=" " for f in `ls -1 .`; do echo "I found a file! => $f" done IFS=$IFS_BAK IFS_BAK=
Keywords: IFS, EOL, end of line, for-loop, newline, end-of-line,