if [[ "$(uname)" = "SunOS" ]]

What does the following script do?

if [[ "$(uname)" = "SunOS" ]] ; then
PATH="/usr/xpg4/bin:${PATH}"
if [[ -x /usr/ucb/expr ]] ; then
alias expr="/usr/ucb/expr"
fi
fi

uname tells you the name of the platform you are running on. If the output from that is SunOS, add /usr/xpg4/bin to the PATH (making XPG4-compatible programs preferred over the default Sun binaries) and alias expr so it uses the UCB version if it's installed (presumably the XPG4 version is less preferred).

XPG4 is a portability standard, sort of like POSIX. UCB is the older Berkeley Unix stuff.