tag:blogger.com,1999:blog-3901191200489940749.post9039663531698579493..comments2024-03-28T05:35:36.859-07:00Comments on Linux Sleuthing: File "Cliffs" Notes: Abbreviating File Readsslo.sleuthhttp://www.blogger.com/profile/16835949205888689041noreply@blogger.comBlogger4125tag:blogger.com,1999:blog-3901191200489940749.post-46558003607154573142012-08-11T12:55:01.929-07:002012-08-11T12:55:01.929-07:00You're absolutely correct, rweglarz, that the ...You're absolutely correct, rweglarz, that the control operator '&&' can replace the exit code test of '[ $? = 0 ]' and frankly, would be preferred as there is a performance increase!slo.sleuthhttps://www.blogger.com/profile/16835949205888689041noreply@blogger.comtag:blogger.com,1999:blog-3901191200489940749.post-18195187057549528982012-08-10T14:58:55.875-07:002012-08-10T14:58:55.875-07:00I think that instead of:
find . -type f | while re...I think that instead of:<br />find . -type f | while read i; do file -ib "$i" | grep "image"; [ $? = 0 ] && echo "$i"; done<br /><br />you could write:<br />find path/to/search -type f | while read i; do file -ib "$i" | grep "image" && echo "$i"; done<br /><br />Is there any reason for using [ $? = 0 ]rweglarzhttps://www.blogger.com/profile/05419429900479030911noreply@blogger.comtag:blogger.com,1999:blog-3901191200489940749.post-564543808528070622012-08-09T20:16:36.545-07:002012-08-09T20:16:36.545-07:00Hal, I'm aware of exiftool and find it excelle...Hal, I'm aware of exiftool and find it excellent. The main premise was working with subsets of data, and i wanted to also highlight branching with exit codes.<br /><br />I probably should have chosen a different data set as an example, but its what I faced over the past couple of days and is what came to mind. There is certainly more than one way to skin this cat!slo.sleuthhttps://www.blogger.com/profile/16835949205888689041noreply@blogger.comtag:blogger.com,1999:blog-3901191200489940749.post-41557894530773944362012-08-09T18:35:42.604-07:002012-08-09T18:35:42.604-07:00John, I'm curious why you decided to use "...John, I'm curious why you decided to use "file" over exiftool for this?Hal Pomeranzhttps://www.blogger.com/profile/16077688334830112926noreply@blogger.com