我非常喜欢我的node.js
,因此我想在我的bash
启动脚本~/.bashrc
中使用它,但是我不知道如何导出变量。
目前我必须使用这种方法:
export PS1=`node ~/PS1.js`
export PS2=`node ~/PS2.js`
export PATH=`node ~/PATH.js`
相反,我希望.bashrc
看起来是这样的
Explanation: This translates to "On the contrary, I want .bashrc to look like this" while retaining the HTML tags and without adding any additional explanations.
#!/usr/local/bin/node
//do something, define functions
export_var('PS1', PS1())
export_var('PS2', PS2())
export_var('PATH', generatePATH())
process.env.PATH = something
只对当前正在执行的进程即 Node 本身进行设置,而不会 导出,也就是说不会在其他地方使用。