问题
在安装maven时,将冒号(:)写成分号(;)
export MAVEN_HOME=/usr/zm/sources/apache-maven-3.6.0
export PATH=$PATH;$MAVEN_HOME/bin
[root@test_1 source]# source /etc/profile
-bash: id: command not found
-bash: tty: command not found
-bash: whoami: command not found
[root@test_1 source]# sudo -i
-bash: sudo: command not found
解决办法
使用临时环境变量
[root@test_1 source]# export PATH=$PATH:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin #用临时环境变量
[root@test_1 source]# vim /etc/profile#修改文件
export MAVEN_HOME=/usr/zm/sources/apache-maven-3.6.0
export PATH=$PATH:$MAVEN_HOME/bin
[root@test_1 source]# source /etc/profile#命令可以使用了
[root@test_1 source]# pwd
/zm/source
网友评论