little oddity I don't understand

New to Debian (Or Linux in general)? Ask your questions here!

little oddity I don't understand

Postby Fedora » 2019-03-24 18:00

Hello,

I had this strange thing when i was editing a file in vi. I get to root and i am going down the file tree and i have to switch between front / and \ to make it work. Is there a reason to do this.

Code: Select all
root@wood:/home/lincoln# cd
root@mypcname:~# cd /etc
root@mypcname:/etc# cd \apt
root@mypcname:/etc/apt#
 


Why do i have to switch back and forth whats the deal?
User avatar
Fedora
 
Posts: 16
Joined: 2019-03-14 16:50

Re: little oddity I don't understand

Postby Head_on_a_Stick » 2019-03-24 18:43

The backslash (\) is an escape character so in your example it is effectively ignored.
Code: Select all
empty@thanatos:~ $ cd /etc/                                             
empty@thanatos:/etc $ cd \apt
empty@thanatos:/etc/apt $ cd -
/etc
empty@thanatos:/etc $ cd apt
empty@thanatos:/etc/apt $ cd
empty@thanatos:~ $ cd /etc/apt
empty@thanatos:/etc/apt $ cd
empty@thanatos:~ $ cd /etc
empty@thanatos:/etc $ cd /apt
mksh-static: cd: /apt: No such file or directory
2|empty@thanatos:/etc $

The last command fails because it calls the full path to /apt and there is no such directory.
Don't break DebianHow to report bugs

SharpBang GNU/Linux — a pre-configured Openbox/Tint2 desktop running on Debian stable
User avatar
Head_on_a_Stick
 
Posts: 10688
Joined: 2014-06-01 17:46
Location: /dev/chair


Return to Beginners Questions

Who is online

Users browsing this forum: No registered users and 7 guests

fashionable