On Fri, Mar 03, 2017 at 10:04:23PM -0800, Misaki wrote: > > reason for piping: > > echo wat | for i in $(< /dev/stdin); do declare -g new="$i"; done > > > > (using find instead of echo, not sure if better way to loop)
while IFS= read -r file; do blah "$file"; done < <(find . -type f) That's compatible with any filenames that don't contain newlines. To be 100% compatible with ALL possible filenames, you need to use a NUL-delimited stream. On GNU/BSD systems: while IFS= read -rd '' file; do blah "$file"; done < <(find . -type f -print0) On recent-enough POSIX systems: while IFS= read -rd '' file; do blah "$file"; done \ < <(find . -type f -exec printf '%s\0' {} +) See also http://mywiki.wooledge.org/BashFAQ/024 See also http://mywiki.wooledge.org/DontReadLinesWithFor