首页 > macos > MacOS终端:无法使用@ in path访问文件夹

MacOS终端:无法使用@ in path访问文件夹 (MacOS terminal: Can not access folders with @ in path)

2018-12-19 macosterminal

问题

我在我的MacOs终端上面临一种奇怪的行为。

当我尝试自动填充包含@ -sign的文件夹时,显示所有我的/ etc / hosts条目...

cd /usr/local/Cellar/php@

然后按下水龙头显示

@::1                               @localhost.                        @custom-etc-host-entry.domain

我可以为我的用户和root重现这个。

也许有些人可以帮助我找到这个的根本原因。

Thx提前。

解决方法

你需要逃避@\你的路径:

cd /usr/local/Cellar/php\@

然后按Tab键将显示如下内容:

php@5.6/ php@7.2/

问题

I am facing a strange behavior on my MacOs terminal.

When I try to autocomplete a folder which has an @-sign included all my /etc/hosts entries are shown...

cd /usr/local/Cellar/php@

an then pressing tap shows

@::1                               @localhost.                        @custom-etc-host-entry.domain

I can reproduce this for my user and for root.

Maybe some can help me to find the root cause of this.

Thx in advance.

解决方法

You need to escape the @ with \ in your path:

cd /usr/local/Cellar/php\@

Then pressing tab will show something like this:

php@5.6/ php@7.2/
相似信息