Robotics StackExchange | Archived questions

Can't source .bashrc when setup.bash is in a symbolic folder

Hi,

I have a dual system (Ubuntu 18.04 and Windows 10) in a Dell notebook, I want all my codes to store in a folder of windows disk, so I create a symbolic link (soft link) in ubuntu with the command ln -s /mnt/windisk/codes ~/codes, that is the folder ~/codes in ubuntu point to the folder /mnt/windisk/codes in windows, and I can use the files in ~/codes folder with cd command or directly with Files Manager.

However, source ~/.bashrc not work even though I have added the source command to ~/.bashrc. For example:

Do you have any idea about this problem? Thanks!

Asked by lyh458 on 2021-01-05 21:39:41 UTC

Comments

If closing a question as a duplicate, please always link to the whatever this is a duplicate of.

Asked by gvdhoorn on 2021-01-06 04:35:27 UTC

And an observation:

I want all my codes to store in a folder of windows disk, so I create a symbolic link (soft link) in ubuntu with the command ln -s /mnt/windisk/codes ~/codes, that is the folder ~/codes in ubuntu point to the folder /mnt/windisk/codes in windows, and I can use the files in ~/codes folder with cd command or directly with Files Manager.

don't do this.

Windows file systems and Linux file systems use different ways to encode permissions, leading to all sorts of problems when trying to do what you describe.

I'd strongly suggest you reconsider what you are attempting to do.

If you want to keep things in-sync between Windows and Linux, use a proper version control system, such as Git.

Asked by gvdhoorn on 2021-01-06 04:37:20 UTC

Thanks, @gvdhoorn. I have solved the problem. This is actually a workspace overlaying problem. Because I have several workspaces, some environment variables of them would be overlaid when run source ~/.bashrc, and which results in the packages missing. In my case, the environment variables are stored in <catkin_ws>/devel/_setup_util.py line 271 CMAKE_PREFIX_PATH.

So I create a new workspace (such as catkin_overlay_ws) specifically for storing all environment variables of other workspaces and only add source ~/Codes/catkin_overlay_ws/devel/setup.bash to ~/.bashrc. And now, everything is ok.

BTW, Git is a good in-sync tool, but not suitable for large files. I want all my codes and files created or modified in ubuntu can be saved in the same folder/disk as windows, and so far I have not met any permission problem.

Asked by lyh458 on 2021-01-06 08:38:44 UTC

If you're happy, I'm happy. I've seen far too many workspaces get corrupted by doing what you are doing.

Besides permission problems, NTFS is also very slow compared to Linux FS, so performance may be poor.

Asked by gvdhoorn on 2021-01-06 08:50:21 UTC

Answers