diff --git a/lighttpd/lighttpd.lua b/lighttpd/lighttpd.lua new file mode 100644 index 0000000..bbe81a3 --- /dev/null +++ b/lighttpd/lighttpd.lua @@ -0,0 +1,18 @@ +--- +permalink: /cgi/lighttpd/index.lua +--- + +-- Function to execute shell commands +local function shell_exec(command) + local handle = io.popen(command) + local result = handle:read("*a") + handle:close() + return result +end + +local lighttpd = shell_exec('lighttpd -v') + +io.write("Content-Type: text/plain; charset=utf-8\r\n\r\n") + +io.write(lighttpd:sub(10, 15)) + diff --git a/uname/uname.lua b/linux/linux.lua similarity index 90% rename from uname/uname.lua rename to linux/linux.lua index 05f143b..a57bcb0 100644 --- a/uname/uname.lua +++ b/linux/linux.lua @@ -1,5 +1,5 @@ --- -permalink: /cgi/uname/index.lua +permalink: /cgi/linux/index.lua --- -- Function to execute shell commands @@ -23,5 +23,5 @@ local res = string.sub(uname, 1, pos - 1) io.write("Content-Type: text/plain; charset=utf-8\r\n\r\n") -- Output the result -io.write(res) +io.write(res:sub(7, 12))