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

You have really proven your point even more than you meant to. Unfortunately none of these examples are robust.

The "-r" flag allows backslash escaping record terminators. The "find" command doesn't do such escaping itself, so that flag will cause files with backslashes at the end to concatenate themselves with the next file.

Furthermore, if IFS='' is not placed before each instance of read, or set somewhere earlier in the program, than each run of white-space in a filename will be converted into a single space.

EDIT: I proved your point even more. The "-r" flag does the opposite of what I thought it did, and disables record continuation. So the correct way to use read would be with IFS='' and the -r flag.




Love it. And I wouldn’t be surprised in the least if even this fell apart in some scenarios too.




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

Search: