是否可以将一个外壳的变量更新为另一个外壳? [英] Is it possible to update a varible from one shell to another shell?

查看:73
本文介绍了是否可以将一个外壳的变量更新为另一个外壳?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何将变量从一个外壳更新到另一个外壳?

How can we update a variable from one shell to another shell ?

假设我要打开2个Putty会话,我想在第一个SHELL中设置一个变量,我需要该变量才能从第二个SHELL进行访问.

Suppose , I am having 2 Putty sessions opened , I want to set a variable in the first SHELL and I need that variable to access from the 2nd SHELL .

有可能吗?

推荐答案

由于每个进程的环境都受到保护,因此无法共享环境变量.我建议使用共享文件系统上的文件来存储所需的变量,并在需要知道新值是什么时读取该文件.

As each process' environment is protected, there's no way to share environment variables. I would suggest using a file on a shared filesystem to store the variable you want and reading that file in whenever you'd need to know what the new value is.

这篇关于是否可以将一个外壳的变量更新为另一个外壳?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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