函数:os.execute 执行 shell 命令
函数名称:执行 shell 命令
函数功能:执行 shell 命令
函数方法
flag = os.execute(command)
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| command | string | 是 | 需要执行的 shell 命令 |
| 返回值 | 类型 | 说明 |
|---|---|---|
| flag | - | 成功 → 返回 true、"exit" 、 0, 失败 → 返回 nil、"exit" 、 终止码(或 "signal"、信号值) |
注意事项
不支持 iOS 小精灵。
15 以上系统隐根越狱不支持此函数,请更换以下代码再试
local ts = require("ts") function getKillallPath() tableGet = ts.hlfs.getFileList("/var/containers/Bundle/Application",true) if tableGet then for i,v in pairs(tableGet) do if v:match("^%.jbroot%-") ~= nil then return "/var/containers/Bundle/Application/" .. v end end else dialog("没有找到指定目录") lua_exit() end end 自定义操作 = "" --请填写需要执行的命令 ts_execute(getKillallPath() .. "/usr/bin/killall "..自定义操作)