ubuntu - 如何在 Luci openwrt sys.exec() 函数中传递命令行参数?

标签 ubuntu lua openwrt luci

我想使用命令行参数执行sys.exe函数。我的代码是

var1 = "myname"
var2 = "address"
function btn.write()  
   luci.sys.exec("/bin/register $var1 $var2")
end

我知道这是错误的。如何将参数传递给 Luci OpenWrt 中的 sys.exe 函数?有什么帮助吗?谢谢。

最佳答案

使用简单的字符串连接:

luci.sys.exec("/bin/register" .. $var1 .. " " .. $var2 .. " ")

关于ubuntu - 如何在 Luci openwrt sys.exec() 函数中传递命令行参数?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44029397/

相关文章:

openwrt - 正在安装 "opkg"?

php - 本地 apache 服务器上的奇怪 memcache 行为

python - Ubuntu Modoboa 从 NGINX 到 APACHE2 : HttpS 403 forbidden while HTTP is correctly accessible. (mod_WSGI)

python - 函数 np.interp 和 pandas Python 出错

Dockerfile, 如何安装 snap, snapd : unrecognized service

syntax - 是否可以在 Lua 中复制 Ruby 的 method_missing?

c++ - 创建独立的可执行 c++ 嵌入 Lua 动态库链接? ( eclipse ,Ubuntu)

c - 使用 C 获取 IP 版本 6

process - Lua:如何检查进程是否正在运行

linux - fs 网络摄像头 : Unable to load font 'luxisr' : libgd was not built with FreeType font support