For the sake of simplicity, suppose the following situation, where folder is a symlink to new_folder:
. ├── folder -> new_folder/ ├── new_folder │ └── test.sh └── exectest.sh
The contents of test.sh are:
#!/bin/bash echo 'test'
The contents of exectest.sh are:
#!/bin/bash echo 'executing test' ./folder/test.sh
If I run
./exectest.sh, the output is as expected:
executing test test
Now let's suppose I want to remove folder, so I'll do
unlink folder. But if I run
./exectest.sh, it'll throw an error:
executing test ./exectest.sh: line 3: ./folder/test.sh: No such file or directory
So my question is: how to remove folder without breaking exectest.sh?
If that matters, something similar is happening with my user folder: when I bought this computer, the ~ directory was /home/user/. After a while, I decided to change it to /home/new_user/. As in that period I had installed some programs that depended on /home/user/, I created a symlink called /home/user/ pointing to /home/new_user/. Now I want to remove /home/user/ and keep only /home/new_user/, but it will break some files that still depend on it.
What to do in this situation? Thanks in advance.