Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

echo * does not have the newline after each file


You wouldn’t iterate over `echo *` anyway. This works just fine in bash/sh:

    for file in *; do
        echo "$file"
    done


True, echo * will print all the filenames on one line, with a space between pairs, but for data processing purposes, the two snippets are equivalent, because as per shell behavior, newline, tab and space are all treated as space, unless quoted. Like the definition of whitespace in the K&R C book. After all, Unix is written in C.




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

Search: