Hacker News
new
|
past
|
comments
|
ask
|
show
|
jobs
|
submit
login
Ask HN: Why is CD.. in the root directory not an error?
2 points
by
oweiler
on Feb 19, 2023
|
hide
|
past
|
favorite
|
2 comments
The title says it all. Why is the resulting status code 0?
$ cd / $ cd .. $ echo $? # is 0, but shouldn't that be 1?
josephcsible
on Feb 19, 2023
[–]
If ".." didn't exist in the root directory, then it would be an error. But it does exist, and it just points back at itself like "." does.
simonblack
on Feb 20, 2023
|
parent
[–]
Just like zero is the lowest number you can obtain in an unsigned number series.
0 -1 = 0;
Guidelines
|
FAQ
|
Lists
|
API
|
Security
|
Legal
|
Apply to YC
|
Contact
Search: