• Post Reply Bookmark Topic Watch Topic
  • New Topic

absolute path and the down path  RSS feed

 
ekte spiriopoulos
Ranch Hand
Posts: 217
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
: this is an absolute path.I have questions about this path.Can someone make changes on it and ask me if is right or wrong so
this is false , right?
this is right ?
this mean the one full step the students BUT i think is false.
is a down path ? :
is a down path? :
is a down path? :
 
fred rosenberger
lowercase baba
Bartender
Posts: 12563
49
Chrome Java Linux
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm not sure what you mean by

../home/students/ek/
this is false , right?

Do you mean "can I do something like "cd ../home/students/ek/?" The answer is "maybe". the double dots mean "go up one level". Let's assume you have this directory structure:


if you were in the /visitor directory, it is legal to say "go up one level, then go down to the /home/students/ek directory.". however, if you were in the temp1 directory, it would NOT be legal, because if you go up on level, you can't then go down to a directory named "home".

it would work the same for something like "cd /home/../ek/". Since it starts with a slash, it puts you in the /home directory regardless of where you are. but then the .. has you go up a level to above "home", then you try to go down to "ek", which doesn't exist there.

A single dot means the current directory. so "/home/./ek/" effectively means "go to the /home directory, then stay there, then go down to the "ek" directory. it seems to work fine on my AIX server.

 
ekte spiriopoulos
Ranch Hand
Posts: 217
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
fred rosenberger wrote:I'm not sure what you mean by

../home/students/ek/
this is false , right?

Do you mean "can I do something like "cd ../home/students/ek/?" The answer is "maybe". the double dots mean "go up one level". Let's assume you have this directory structure:


if you were in the /visitor directory, it is legal to say "go up one level, then go down to the /home/students/ek directory.". however, if you were in the temp1 directory, it would NOT be legal, because if you go up on level, you can't then go down to a directory named "home".

it would work the same for something like "cd /home/../ek/". Since it starts with a slash, it puts you in the /home directory regardless of where you are. but then the .. has you go up a level to above "home", then you try to go down to "ek", which doesn't exist there.

A single dot means the current directory. so "/home/./ek/" effectively means "go to the /home directory, then stay there, then go down to the "ek" directory. it seems to work fine on my AIX server.

aa i dont mean that Anyway thanks .What i wrote was to ''recognize'' which one is absolute path or relative path for example /home/dan/hrk/ that i know because it starts with a / is absolute.If it was on the same system /dan/hrk/ is absolute path?because again starts from / ? i wrote up this questions because it is complicated
 
Henry Wong
author
Sheriff
Posts: 23295
125
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ekte spiriopoulos wrote:Anyway thanks .What i wrote was to ''recognize'' which one is absolute path or relative path for example /home/dan/hrk/ that i know because it starts with a / is absolute.If it was on the same system /dan/hrk/ is absolute path?because again starts from / ? i wrote up this questions because it is complicated


Not sure what you mean by "complicated", because as you mentioned, if the path start with "/", then it is an absolute path.

Henry
 
ekte spiriopoulos
Ranch Hand
Posts: 217
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Henry Wong wrote:
ekte spiriopoulos wrote:Anyway thanks .What i wrote was to ''recognize'' which one is absolute path or relative path for example /home/dan/hrk/ that i know because it starts with a / is absolute.If it was on the same system /dan/hrk/ is absolute path?because again starts from / ? i wrote up this questions because it is complicated


Not sure what you mean by "complicated", because as you mentioned, if the path start with "/", then it is an absolute path.

Henry
In my example i gave this will be /dan/hrk/ a absolute path?
 
Paul Clapham
Sheriff
Posts: 22819
43
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If the path starts with / then it's an absolute path. If the path doesn't start with / then it's a relative path.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!