Let's say someone creates two files with newlines in them:
touch file\n1 file\n2If I want to write a script that can properly iterate through those files, I can do something like this:
for f in * ; echo [$f] ; end The output is, as one might expect: [file 1] [file 2] However, if I do this: for f in (find . -type f) ; echo [$f] ; endI (predictably) get this:
[./file] [1] [./file] [2]In bash, I could iterate through those files using an ugly hack consisting of messing clearing IFS environment variable and (ab)using the 'read' builtin:
find . -type f -print0 | while IFS= read -rd $'\0' f ; do echo "[$f]" ; doneIt there a way to do command substitution that uses NUL as a separator instead of newline?
-- Dwayne C. Litzenberger <[EMAIL PROTECTED]> Key-signing key - 19E1 1FE8 B3CF F273 ED17 4A24 928C EC13 39C2 5CF7 Annual key (2008) - 4B2A FD82 FC7D 9E38 38D9 179F 1C11 B877 E780 4B45
signature.asc
Description: Digital signature
------------------------------------------------------------------------- Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://sourceforge.net/services/buy/index.php
_______________________________________________ Fish-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/fish-users
