How can I get the dev name associated to a Volume name? I am creating a bash script to unmount my usb drive after the backup is done.
To unmount the drive I use the command:

diskutil unmount disk4s1


But sometimes when I plug my usb drive it gets a different dev name, as disk3s1, or disk2s1.
I need add a line in my script before unmount the disk, to get the dev name associated to my volume name.

What command could I use to get the dev name given its volume name?
mount | grep /Volumes/foo | cut -d ' ' -f1


or

mount | awk '/Volumes\/foo/ { print $1 }'