如何在bash_profile文件中添加导出语句? [英] How to add export statement in a bash_profile file?

查看:60
本文介绍了如何在bash_profile文件中添加导出语句?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图了解是否必须添加export语句以在bash_profile文件中设置变量.我该怎么做?例如,如果我必须添加export AX ='name',那么我应该将其简单地写在文件末尾还是需要写其他内容

I'm trying to learn that if I have to add export statement to set a variable in a bash_profile file . How would I do that ? For example if I have to add export AX = 'name' then should I simply write it at the end of file or do I need to write anything else as well

推荐答案

只需在〜/.bash_profile 文件中的任意位置写入 export AS ='name':

Simply write export AS='name' anywhere in your ~/.bash_profile file:

# Append to the end of the file
$ echo "export AS='name'" >> ~/.bash_profile

# Update shell 
$ source ~/.bash_profile

第一个命令将所需的行添加到文件(或仅使用文本编辑器),第二个命令使用新变量更新外壳.

This first command adds the line you want to the file (or just use a text editor) the second updates the shells with the new variable.

这篇关于如何在bash_profile文件中添加导出语句?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆