There are a bunch of files in a remote directory which I want to access over
sshfs and then script some operations. In practice, I wish to access different files at different times, and perform different operations on those files.
Option 1: Mount the whole directory (one script). Then, run any file-specific script of my choosing.
Option 2: Bundle the process of mounting the directory together with the file-specific script.
Disadvantage of option 1: Before running the file-specific script, I forget whether the folder is mounted at all. It takes only 10 seconds to check, but is a minor irritation. I don't want the folder to be mounted at all times, or by default.
Disadvantage of option 2: When processing a second or third file, I end up using
sshfs to mount a remote directory which is already mounted. Can this do any harm?
With respect to option 2, I suppose it's possible to check whether the directory is already mounted, like this: Check if directory mounted with bash [closed]. Does that sound like the best solution?