Can't source .bashrc when setup.bash is in a symbolic folder [closed]
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:
- I create a workspace
catkin_ws
in folder~/codes
, then a package nametest
insrc
folder, catkin_make
successfully.- Add command
source ~/codes/catkin_ws/devel/setup.bash
in~/.bashrc
, the source it with commandsource ~/.bashrc
Run
roscd tes
, and double press the keyboard keysTab
, it can't automatically completeroscd test
, which means thatsource ~/codes/catkin_ws/devel/setup.bash
not work well.But if I directly run
source ~/codes/catkin_ws/devel/setup.bash
orsource /mnt/windisk/codes/catkin_ws/devel/setup.bash
, or addsource /mnt/windisk/codes/catkin_ws/devel/setup.bash
in~/.bashrc
, everything work well.
Do you have any idea about this problem? Thanks!
If closing a question as a duplicate, please always link to the whatever this is a duplicate of.
And an observation:
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.
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 271CMAKE_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.
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.