Skip to main content
16 events
when toggle format what by license comment
Mar 4, 2021 at 8:55 comment added Kusalananda @rubo77 I did, just now.
Mar 4, 2021 at 8:31 comment added rubo77 @kusalananda: please provide a separate answer with your solution, so we can upvote it
Mar 4, 2021 at 8:10 comment added Kusalananda @JonathanKomar It is not misleading as none of the precautions are taken in this answer. Changing IFS to contain a nul character implies a shell that can store these in variables. The bash shell does not do that. read -d is bash-specific (xargs -0 would be a better fit as it isn't dependent on the shell, even though it's still not standard). My point is that if you can do it right, in a way that is portable and safe, then there is no reason to make it unportable and/or unsafe. find has -exec for the very reason to provide a way to iterate over found pathnames with user code!
Mar 4, 2021 at 6:49 comment added Jonathan Komar @Kusalananda "Don't loop over the output of find" is misleading. It is fine, provided that output elements are not line-terminated (the default), rather null-terminated. This would require changing the IFS to the 0-byte OR making read handle it with read -d. Then even filenames containing newlines would be processed correctly.
Jan 26, 2021 at 19:32 comment added Kusalananda Don't loop over the output of find. It doesn't matter that you set IFS to an empty string, it will still break on filenames containing newlines. It doesn't matter that these filenames are rare, if it's easy to write code that copes with all filenames, then there's no reason to write code that doesn't.
Jul 7, 2017 at 7:10 history edited rubo77 CC BY-SA 3.0
added 108 characters in body
Apr 13, 2017 at 12:36 history edited CommunityBot
replaced http://unix.stackexchange.com/ with https://unix.stackexchange.com/
Aug 22, 2016 at 17:35 history edited rubo77 CC BY-SA 3.0
added 206 characters in body
Dec 20, 2015 at 8:00 history edited rubo77 CC BY-SA 3.0
added 64 characters in body; edited body; added 5 characters in body
Oct 22, 2013 at 6:30 history edited rubo77 CC BY-SA 3.0
no need of a function
Oct 22, 2013 at 6:04 history edited rubo77 CC BY-SA 3.0
deleted 10 characters in body
Oct 22, 2013 at 5:32 history edited rubo77 CC BY-SA 3.0
deleted 15 characters in body
Oct 22, 2013 at 5:32 vote accept rubo77
Oct 22, 2013 at 5:06 comment added rubo77 I found this solution on: stackoverflow.com/a/8489394/1069083
Oct 22, 2013 at 5:05 history edited rubo77 CC BY-SA 3.0
added 49 characters in body
Oct 22, 2013 at 4:50 history answered rubo77 CC BY-SA 3.0