方式一

ubuntu系统下,环境变量的文件在/etc/profile修改完成之后执行source /etc/profile命令。

vim /etc/profile
export PATH=$PATH:/root/embedded/gcc-arm-none-eabi/bin
source /etc/profile

如果直接暴露 export PATH=$PATH:/root/embedded/sdcc/bin,针对的是每次ssh连接,ssh连接断开之后会删除。

方式二

1.编辑用户目录下的 .bashrc 文件

vim ~/.bashrc

2.在文件末尾添加下面这行:

export PATH=$PATH:/root/embedded/sdcc/bin

3.配置立即生效

source ~/.bashrc