I downloaded lessn to my webserver and unzipped it.
It contains a folder named -
. I assumed I know how to deal with that, but I don't.
I tried cd -- -
, but that doesn't have the desired effect. Using quotes doesn't seem to affect it either. I put slashes all over the place, to no avail.
What's the proper way to change into this folder?
Best Answer
You want to avoid it from being a parameter, thus we try to prepend something to it. The current directory can be accessed with
.
, thus the subfolder-
can be accessed alternatively with./-
.The reason that
cd -- -
doesn't work is because this is implemented differently if you comparerm
(seeman rm
) tocd
(seeman bash
orman cd
),cd
has a different interpretation which sees-
as a parameter (seeman bash
orman cd
).It should also be noted that
cd
is a shell builtin function, as can be read in this answer:There is an external
cd
command, but it does something entirely different.This explains why the implementation is different, as Bash and Coreutils are two different things.
Let's just suppose you wouldn't believe this, how do we confirm that? Use
which
andtype
.See
man which
for more information, andman bash
orman type
fortype