Fixed bug where P4PORT value might be 'Unset'.
This could be observed due to a misconfiguration where the
P4MASTER_ID value set in the instance vars file,
/p4/common/confg/p4_N.vars, was incorrect (i.e. didn't match
the actual ServerID of the master/commit server). Or if a
replica was only partially defined without P4TARGET being
defined. These misconfigurations are outside the realm of
this script to address, but they exposed a bad assumption in
the script. That has been corrected.
Also:
* Added logic to ensure 'p4d -cshow' is not attempted unless
$P4ROOT/db.config exists, for error-free operation on proxy and
replica servers that have no p4d.
* Several unrelated minor tweaks were made to help with shellcheck
compliance.