linux下非root执行export命令出现 export: command not found 错误
[root@mysqlserver bin]# csh
[root@mysqlserver /bin]# export
export: Command not found.
[root@mysqlserver /bin]#
export是shell的内部命令,寻找规则与PATH变量无关。
重点检测SHELL变量是不是bash,如下
查看SHELL变量, echo $SHELL
[root@mysqlserver bin]# echo $SHELL
/bin/bash
[root@mysqlserver bin]#
如果是
/bin/csh
那么执行bash命令启动bash,或者在对应的脚本前执行bash命令。
[root@mysqlserver bin]# bash
[root@mysqlserver bin]# export AAA=nn
[root@mysqlserver bin]#
具体指定用户的shell环境的配置文件在/etc/passwd 中
[root@mysqlserver bin]# cat /etc/passwd
root:x:0:0:root:/root:/bin/bash
~~~~
修改对应的shell配置即可。