I'm running RHEL 7 and bash here. It seems command substitution does not work for the umount command. It does, however, work as usual for other commands. For example:
[root@localhost ~]# msg=$(umount /u01)
umount: /u01: target is busy.
(In some cases useful info about processes that use
the device is found by lsof(8) or fuser(1))
[root@localhost ~]# echo "$msg"
- nothing here -
[root@localhost ~]# msg=$(mountpoint /u01)
[root@localhost ~]# echo "$msg"
/u01 is a mountpoint
What I can probably do is to use mountpoint first and then umount if the mountpoint exists. Then check for umount status - if there is an error I guess the device must be busy.