3
~$ alias Any_Name=/home/User/Desktop/Folder\ Name
~$ Any_Name
bash: /home/User/Desktop/Folder: No such file or directory
~$

that same bash error is shown even if double quotes is used

So how do i reach that folder using the alias command ?

~$ cd "$Any_Name"
~$
~$ cd $Any_Name
~$ pwd

/home/User

Also does not seem to work

devilz
  • 169
  • 1
  • 3
  • 16

1 Answers1

3

It is ...

cd "$Any_Name"

Environment variables need to be evaluated.

And also ...

 alias Any_Name="/home/User/Desktop/Folder\ Name"

By the way ...

:~$pwd
/home/rinzind
:~$ alias
alias a='cd /tmp'
:~$ a
:/tmp$ pwd
/tmp
:/tmp$

I forgot this was about spaces ...

:~$ cd /tmp/
:~$ mkdir "tmp 2/"
:~$ alias a="cd /tmp/tmp\ 2/"
:~$ a
:/tmp/tmp 2$
Rinzwind
  • 299,756