Results 1 to 4 of 4
What do these commands do
Code:
cd \
I get a > after entering this command and come out using cntrl+d and don't understand what it does
the other one ...
- 06-18-2009 #1
cd \ and cd //
What do these commands do
I get a > after entering this command and come out using cntrl+d and don't understand what it doesCode:cd \
the other one isThis takes me to a dir // and i see the contents of the /Code:cd //
Only if I could understand the man pages
Registered Linux user #492640
OS: RHEL4,5 ,RH 9,Ubuntu
- 06-18-2009 #2
Actuallty backslash is used override special char commands
you can use them for files that contain special chars like *,@,! etc.
you get > because its a linux feature wherein you can enter a long command, meaning the prompt waits for you enter command continuation.
IMO, this is just a typo, linux ignores the second slash
- 06-18-2009 #3Linux Guru
- Join Date
- Nov 2007
- Location
- Córdoba (Spain)
- Posts
- 1,513
\ scapes the next character so it's not interpreted by bash. In this case, it scape the carry return so, to bash, you haven't terminated the command, and it keeps asking for more.
You could do
Or you could doCode:ls -l /my/dir
They are equivalent.Code:ls \ -l \ /my/dir
The number of slashes doesn't change the meaning of the command. ls / and ls ////////// are the same. This is a particularity that avoids a lot of trouble when concatenating directories.the other one isThis takes me to a dir // and i see the contents of the /Code:cd //
For example, imagine that a script has to concatenate a path and a file name. The path is contained in $DIR and the file name is contained in $FILE. Both need to be entered by the user, but the user can choose to enter "/my/path" or "/my/path/". Since you don't know beforehand, it's a tad convenient that you can join both in your script this way:
If the user entered "/my/path", $foo will contain /my/path/my_file, if the user entered "/my/path//my_file", and both will be correct. This is used everywhere. If you examine the logs you can probably find lots of paths with more than one consecutive slash in the middle somewhere.Code:foo="$DIR/$FILENAME"
- 06-18-2009 #4
thanks now it is clear
Only if I could understand the man pages
Registered Linux user #492640
OS: RHEL4,5 ,RH 9,Ubuntu


Reply With Quote
