You can set up your sessions to keep rereading a file on disk by setting a trap on DEBUG in your .bashrc:trap 'source ~/.myvars' DEBUG如果将终端A保持打开状态,请运行 echo VAR = 42>>〜/.myvars 在终端B中,然后切换回终端A并回显$ VAR ,它将被神奇地"设置.If you leave a terminal A open, run echo VAR=42 >> ~/.myvars in terminal B, then switch back to terminal A and echo $VAR, it'll "magically" be set. 这篇关于如何将shell变量导出到所有会话?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
08-19 20:16