当我通过 SSH 进入我的 ubuntu 服务器时,我得到了正常的系统信息闪现,但随后一个命令立即运行,我似乎无法追踪它。
Last login: Tue Jun 30 15:20:22 2015 from [removed]
][: command not found
Usage: java [-options] class [args...]
(to execute a class)
or java [-options] -jar jarfile [args...]
(to execute a jar file)`
我认为这是我尝试正确安装 Java 以便与 Jira/Confluence 一起使用时发生的。
我尝试回溯我看过的一些旧指南,但似乎找不到我可能][
意外进入的地方。有什么想法吗?
答案1
启动交互式登录 shell 时读取的用户配置文件如下ssh
:
用户配置文件
~/.bash_profile
,~/.bash_login
,~/.profile
(其中任何一个,按此顺序搜索)全局配置文件
/etc/profile
现在提到的问题肯定存在于这些文件之一中,或者存在于源自这些文件的任何其他文件中。所以我们需要搜索这些文件,并且~/.bashrc
需要包含在 Ubuntu 中,因为~/.bashrc
它源自~/.profile
。
如果][
我们可以这样做:
grep '\]\[' ~/.bash_profile ~/.bash_login ~/.profile ~/.bashrc /etc/profile 2>/dev/null
另一方面,如果java
我们需要:
grep 'java' ~/.bash_profile ~/.bash_login ~/.profile ~/.bashrc /etc/profile 2>/dev/null
找到有问题的行之后,我们需要修复它们以使其正确(或者如果不需要则删除它们)。