Shift key on mac keyboard only works with some keys
Given the problem appears on two Macs, this suggests a hardware fault. If the keyboard is not too old, take it to an Apple Store. They may be able to replace it for you.

The strange behaviour you are seeing could be because a circuit is damaged and causing ghosting. Microsoft's article on ghosting explains more:


  What causes ghosting?
  
  Typically, ghosting is the result of one or more of following three limitations: the hardware can't read the given key combination, the software on the computer doesn't support multiple simultaneous keys, or the communication protocol between the hardware and software limits the maximum number of simultaneous keys reported. The next section discusses in more detail the hardware design of typical keyboards that limits the number of keys that can be read at the same time.