In tcsh
:
sh
uname -v && date &&\
2>/dev/null find /opt/X11/bin /opt/local/bin /opt/local/sbin \
/bin /sbin /usr/X11/bin /usr/bin /usr/local/bin /usr/sbin \
/Applications /Developer /Library /System ~/Applications \
-type f -perm +111 -exec lipo -info '{}' ';' | grep -E \
"(i386|x86_64|i860|i486|i486SX|pentium|i586|pentpro|i686|pentIIm3|pentIIm5|pentium4)" &&\
date && exit
The number of lines of output can be counted in a text editor such as TextWrangler. Subtract from the beginning the few lines up to and including the date and time, subtract from the end the two lines that include the date and time, that leaves an approximate figure.
If you wonder why the grep is for any of twelve architectures (not two): it's to consider all currently known architectures where the description, in the man page for arch, includes Intel. Finding anything other than i386 or x86_64 may be rare or unknown at the moment, but I'd like the answers to this question to stand the test of time, to be not limited to those two.
As an answer, this is far from ideal …
I had to
2>/dev/null
before the pipe to prevent a ton of crap from being printed. – Daniel Beck – 2012-01-31T09:48:35.267Thanks Daniel. I edited my question to make clear that I manually count the number of lines of output (I don't know whether this can be plumbed). Did you use tcsh? – Graham Perrin – 2012-01-31T09:49:51.413
2
Consider posting your approach as an answer, like I did e.g. here.
– Daniel Beck – 2012-01-31T09:50:07.760I'm playing around with it right now, but no, I use bash. – Daniel Beck – 2012-01-31T09:50:37.790