The command uname -m
will tell you what architecture you are on. For example, on my system right now:
$ uname -m
x86_64
I might suggest putting archful binaries into ~/bin/i686
and ~/bin/x86_64
. (Or, if it's 32-bit Power or something else, whatever uname -m
returns.) Then, in ~/.bash_profile
(which is the right place for this, have a line like this:
PATH=$PATH:~/bin/$(uname -m)
which will append this new arch-specific bin path to your existing path.
Or, if you want something other than the machine architecture, use a different distinguisher. For example, an easy way to tell CentOS versions is to look at the version of the centos-release
package, with rpm -q
, so, like this:
PATH=$PATH:~/bin/centos$(rpm -q --qf '%{VERSION}' centos-release)
which will get you either ~/bin/centos6
or ~/bin/centos7
— although there's no error handling, so on Fedora or something you'll get a nonsensical error message right in the path. (Maybe check for whether centos-release exists with an if
statement before even running this.)
You can also add --nosignatures --nodigest
to speed up this RPM command by a few hundredths of a second. Not a big deal, but since it'll happen at every new login shell, seems worth the extra typing.
There is a slight misunderstanding here, both are 64bit, it is the version of centos that differs, still +1 – statquant – 2017-01-15T22:37:20.680
Oh, I see. In that case, same basic concept but use a different distinguisher. – mattdm – 2017-01-15T22:47:48.010