Thursday, May 2, 2024
2
rated 0 times [  2] [ 0]  / answers: 1 / hits: 2290  / 2 Years ago, fri, february 4, 2022, 8:04:55

I tried creating a shortcut to easily change into some of my Windows partitions. After mounting them, some works fine, some not. Here's what happens.



My ~/.bash_aliases contains:



export geo=/media/geo/Novo volume/Geo
export windows=/media/geo/OS/Users/Geo


When I type in terminal



geo@george-Ubuntu:~$ cd $windows
geo@george-Ubuntu:/media/geo/OS/Users/Geo$


it works as expected.



However, when I try:



geo@george-Ubuntu:/media/geo/OS/Users/Geo$ cd $geo
bash: cd: /media/geo/Novo: No such file or directory


It can't find the directory (made sure that "Novo Volume" is mounted and the directory exists)



How can I fix this? Symbolic Link: No such file or directory Didn't help me.


More From » command-line

 Answers
7

You see:



bash: cd: /media/geo/Novo: No such file or directory


since you tried to set a variable for the folder "/media/geo/Novo volume/Geo" (with a space) and the error is about only the first part of the path up to the space, you see, that the space is wrongly treated as separator.



If you want to use



cd $geo


yuo could have to include the quotes in the string:



export geo='"/media/geo/Novo volume/Geo"'


which isn't a good solution, a better approach is to set an alias in your .bash_aliases for example:



alias cd-geo='cd "/media/geo/Novo volume/Geo"'
alias cd-windows='cd /media/geo/OS/Users/Geo'

[#22022] Sunday, February 6, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
cheeturage

Total Points: 432
Total Questions: 111
Total Answers: 115

Location: Bahrain
Member since Tue, Mar 1, 2022
2 Years ago
;