.profile script I want to export a variable if an external USB hardisk is mounted. I need this variable in later Perl scripts to determine if the device is mounted. Especially, if the device is not mounted, the later scripts behave differently.
Since these Perl scripts are also run in a Windows environment, I cannot simply check for the existence of the directory when the scripts are run. Also, the script run on different machines, some of which sometimes have harddisk attached. When the harddisk is attached it won't be removed until the machine is shut down.
Besides, the scripts do their job perfectly and I'd rather not change them.
The device gets mounted to
In my home directory, I have a symbolic link to the mount point:
ln -s /media/rene/DEVICE_NAME ~/ext_hd
So, in my
~/.script file I have the following test
if [[ -d ~/ext_hd ]]; then export device_mounted=yes fi
Now, apparently, these lines are executed before the mount process is finished mounting the external harddisk. Thus, the variable
device_mounted is not assigned.
So, is there a way to wait for the mount process to finish before I execute the test?