Machine-specific settings should be isolated to a separate file which can be sourced from .bashrc
. So your .bashrc
might contain a line like
[[ -f .bashrc.local ]] && . .bashrc.local
Then anything that is specific to a local machine, rather than intended to be shared across machines, would be put in .bashrc.local
instead. Only .bashrc
gets synced.
This does present difficulties if you don't want to isolate all machine-specific settings to one point in your shared .bashrc
file. The alternative is to fill your shared .bashrc
file with conditional code like
case $HOST in
machineA ) do-this ;;
machineB ) do-that ;;
* ) default-behavior ;;
esac
which takes the current value of $HOST
into consideration.