MacOS源.bash_profile导致重复消息打印

时间:2017-04-17 02:34:31

标签: macos terminal .bash-profile

我在终端中使用source .bash_profile时遇到问题。它会打印许多相同的消息:

-bash: /Users/wuyiqing: is a directory
-bash: /Users/wuyiqing: is a directory
-bash: /Users/wuyiqing: is a directory
-bash: /Users/wuyiqing: is a directory
-bash: /Users/wuyiqing: is a directory
-bash: /Users/wuyiqing: is a directory
-bash: /Users/wuyiqing: is a directory
-bash: /Users/wuyiqing: is a directory
-bash: /Users/wuyiqing: is a directory
-bash: /Users/wuyiqing: is a directory
-bash: /Users/wuyiqing: is a directory
-bash: /Users/wuyiqing: is a directory
-bash: /Users/wuyiqing: is a directory
-bash: /Users/wuyiqing: is a directory
-bash: /Users/wuyiqing: is a directory
-bash: /Users/wuyiqing: is a directory

当我重新打开终端时,会再次打印相同的重复消息:

Last login: Mon Apr 17 10:11:57 on ttys000 -bash: /Users/wuyiqing: is a directory -bash: /Users/wuyiqing: is a directory -bash: /Users/wuyiqing: is a directory -bash: /Users/wuyiqing: is a directory -bash: /Users/wuyiqing: is a directory -bash: /Users/wuyiqing: is a directory -bash: /Users/wuyiqing: is a directory -bash: /Users/wuyiqing: is a directory -bash: /Users/wuyiqing: is a directory -bash: /Users/wuyiqing: is a directory -bash: /Users/wuyiqing: is a directory -bash: /Users/wuyiqing: is a directory -bash: /Users/wuyiqing: is a directory -bash: /Users/wuyiqing: is a directory -bash: /Users/wuyiqing: is a directory -bash: /Users/wuyiqing: is a directory MacBook-Pro:~ wuyiqing$ 我的.bash_profile是这样的:

export PATH=${PATH}:/usr/local/mysql/bin export PATH=$PATH:/Users/keso/Library/Tomcat/bin ~ ~ ~

我试图解决这个问题,但失败了。怎么能让重复信息消失?

1 个答案:

答案 0 :(得分:0)

.bash_profile中的~行将导致该错误消息。 ~是主文件夹路径的shell简写,因此这些行会扩展为/Users/wuyiqing。由于这是第一件事,它被视为执行命令,但它不是命令,它是一个目录,所以你得到消息&#34 ; / Users / wuyiqing:是一个目录"。

有一件事让我感到困惑:根据您发布的内容,.bash_profile包含三行~行,但您将其视为错误消息的十六次。你发布了完整的.bash_profile吗?无论如何,解决方案很简单:删除这些行。