Find All Locations Of A Binary Using `type’ not `which’

I can’t find the git 2.10 binary so I run

which git

/usr/local/bin/git

Excellent, found it.

And then I check it’s version to verify I am looking at the right version

/usr/local/bin/git –version

git version 2.21.0

Oops that isn’t what I wanted.

There must be another git getting loaded earlier in the search path.

Here is how to find out where all copies of git live

type -a git

git is /usr/local/bin/git
git is /usr/local/bin/git
git is /usr/bin/git

Look for the right git at version 2.10

/usr/local/bin/git –version
/usr/bin/git –version

git version 2.21.0
git version 2.14.3 (Apple Git-98)

I want the second one.

That is how to track down the location of a binary file on macOS that appears multiple times in the search path.

(Hardware) Best Inexpensive Monitor Ever

Last year I searched for a monitor with these attributes:

  • 23-inch
  • Great color and bright from all angles easy for all-day viewing
  • Cables: HDMI, DVI, and VGA
  • Inexpensive because of the obvious and also the possibility of building a 2×2 monitor grid

The ASUS VS239H-P 23-Inch Full HD 1920×1080 IPS HDMI DVI VGA Back-lit LED Monitor is my winner: it meets all of the criteria.

It is easy to use and looks great. One year old it still is selling well. It is an easy purchase because 8,299 owners ranked it a 4.5/5 so I’m not alone here.

Now join the club.

Avoid Most Bash Errors Pretty Much By Quoting Everything, And More Best Practices

This page shows common errors that Bash programmers make. These examples are all flawed in some way.

You will save yourself from many of these pitfalls if you simply always use quotes and never use WordSplitting for any reason! Word splitting is a broken legacy misfeature inherited from the Bourne shell that’s stuck on by default if you don’t quote expansions. The vast majority of pitfalls are in some way related to unquoted expansions, and the ensuing word splitting and globbing that result.

All of us have fallen into one of these pits.

Why not use Python instead? 🙂

Oh yea, non-interactive shells 😠.

More on Quotes and Word Splitting.