My machine is mymac and the remote machine is remotemac(both are running El Capitan 10.11.6) - I reference a share on remotemac, located at //remotemac/path/to/remoteshare, as /Volumes/remoteshare.
Sometimes, especially when I have recently connected to that remote machine or share from Finder, the /Volumes/remoteshare path is available. But after some time, that /Volumes/remoteshare path is not available.
$ ls /Volumes
Macintosh HD
$ # connect to remoteshare from Finder
$ ls /Volumes
$ Macintosh HD remoteshare
# After some time (a few hours)...
$ ls /Volumes
Macintosh HD
$ # note that /Volumes/remoteshare is now missing
What can I do in my bash script to ensure that the remoteshare volume is present, or created before it is referenced?