For a more visual explanation.
If your BAB is +10 and your strength 18, you have a standard attack bonus with your longsword of:
+14/+9
If you choose to Shield Bash, you get an off-hand attack at your highest attack bonus.
+14
However, you must subtract the penalties for Two-Weapon Fighting from all three attacks. So assuming you have the feat Two-Weapon Fighting, and are using a light shield (which is therefore a light weapon), you'd be at a -2 to your primary weapon attacks, and a -2 to your off-hand attacks:
+12/+7 (longsword) and +12 (shield)