最新公告:

中华视窗是诚信为本,市场在变,我们的诚信永远不变...

中华视窗

咨询热线

400-123-4657

行业资讯

当前位置: 首页 > 新闻动态 > 行业资讯

如何使用lua设置bash环境变量

添加时间:2024-02-23

/

本文介绍了如何使用lua设置bash环境变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!问题描述我很新的lua脚本功能。 我尝试使用

os.( = 10) <

我尝试在执行lua脚本后使用echo $ 从shell中读取变量,但我看不到设置为10。

我们如何使用lua脚本设置环境变量?

解决方案

您的问题不是lua问题。你的问题是误解过程环境如何工作。

每次运行 os. 或 io.popen 您正在使用新环境执行新流程。

所以当你可能会正确地在这个进程环境中设置 (并且会影响作为进程的的子进程运行的任何进程)如果您想影响 lua ,那么这个过程不会被任何其他进程看到。

c $ c>进程的环境(这将反过来影响由lua运行的进程的环境),那么你需要绑定到 系统函数(这个lua本身不提供,因为它不通过lua用于其包含的东西的清洁 C测试。

bash环境_环境巴适_环境baohu

I am new to lua .I tried using,

os.(" =10")io.popen(" =10")

from lua .

I try from shell using echo $ after lua is but I do not see set to 10.

How do we set the using lua ?

解决方案

Your isn't a lua . Your is how work.

Every time you run os. or io.popen you are a new with new .

So while you may be in that (and it would any run as of that ) it doesn't the death of the and so be seen by any other .

If you want to the lua 's (which would then, in turn, the 's of run by lua) then you need a to the (which lua doesn't as it doesn't pass the clean C test that lua uses for it ).

联系我们

电话:400-123-4657

传真:+86-123-4567

地址:浙江 温州市 温州大道欧江大厦26188号

邮箱:admin@zhonghuanews.net

电话:400-123-4657 传真:+86-123-4567 地址:浙江 温州市 温州大道欧江大厦26188号
版权所有:Copyright © 2002-2024 中华视窗 版权所有 ICP备案编号:粤IP**********