如何将cd放入名称为-的目录中? [英] How to `cd` into directory with the name `-`?
本文介绍了如何将cd放入名称为-的目录中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这里是一个例子.我正在创建一个名为-
的目录,但不能cd
进入该目录.命令cd -
将我返回到先前的目录.我有点惊讶cd "-"
以相同的方式工作.我可以使用完整路径~/-
进入该目录,但是还有其他方法吗?
Here is an example. I'm creating a directory named -
and I can't cd
into it. The command cd -
returnes me to the previous directory. And I'm a bit supprised that cd "-"
works the same way. I can enter that directory using the full path ~/-
, but is there other way?
user@server:~$ cd /tmp
user@server:/tmp$ cd
user@server:~$ mkdir -
user@server:~$ cd -
/tmp
user@server:/tmp$ cd
user@server:~$ cd "-"
/tmp
user@server:/tmp$ cd ~/-
user@server:~/-$
推荐答案
改为使用
cd ./-
如果您在上面的目录中.
if you are in the directory above.
这篇关于如何将cd放入名称为-的目录中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文