Skip to content

Instantly share code, notes, and snippets.

@eviltofu
Last active March 22, 2024 17:05
Show Gist options
  • Save eviltofu/7a2aada758ed66d91fa2946eacccd710 to your computer and use it in GitHub Desktop.
Save eviltofu/7a2aada758ed66d91fa2946eacccd710 to your computer and use it in GitHub Desktop.

TILT: xargs and $()

Today I learned that (TILT) I can use xargs and $() to send the output of one command line app to be used as the parameters of the next.

For some reason, I needed the version of make on my macOS. A quick trip to Terminal.app and make --version spits out the required information. But wait, what was this in the corner?

This program built for i386-apple-darwin11.3.0.

So was make an intel binary? file can be used to determine the binary architecture but what was the path to make? Fiddling through the man pages showed me that whence -pa 1 will find all copies (excluding aliases) of make in my PATH.

whence -pa make | xargs file

or

file $(whence -pa make)

Output:

/usr/bin/make: Mach-O universal binary with 2 architectures: [x86_64:Mach-O 64-bit executable x86_64] [arm64e:Mach-O 64-bit executable arm64e]
/usr/bin/make (for architecture x86_64):	Mach-O 64-bit executable x86_64
/usr/bin/make (for architecture arm64e):	Mach-O 64-bit executable arm64e

So make is a universal binary.

Footnotes

  1. I found that which -pa works the same as whence -pa but the which man page does not have -p as an option.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment