@echo59, I'm afraid I can't be of help wrt codes. I did not get head or tail of the code you mentioned . That said, I try to help others by just asking some questions that may be obvious but many times missed. I still think it is possible your drive is not ready by the time link command runs or there is problem with permissions when run from script.
Two more questions,
-
When you say it works when the script is run manually, does it ask for any password for you to input? If so, may be the password method you put in your script is not working.
-
Why do you even have command to create symlink in the script? Once a link is created, doesn't it work whenever the source is available?
What I mean is, to test I created a folder by name 'test' and a link 'linktest' pointing to 'test' folder. When I deleted the folder, the link shows in red (broken) but if I recreate the folder 'test' the link works fine. So, if you created a link for work dump from pCloud in you home directory, doesn't it activate when the drive is mounted via script? Is it really getting decrypted/mounted via script?