IonutParau 687cfebd00 testing version of LuaBIOS and OpenOS
people were having issues getting them to work so now we promote consistency
2025-06-28 20:41:49 +02:00

23 lines
706 B
Lua

local args, options = require("shell").parse(...)
if options.help then
io.write([[
`echo` writes the provided string(s) to the standard output.
-n do not output the trialing newline
-e enable interpretation of backslash escapes
--help display this help and exit
]])
return
end
if options.e then
for index,arg in ipairs(args) do
-- use lua load here to interpret escape sequences such as \27
-- instead of writing my own language to interpret them myself
-- note that in a real terminal, \e is used for \27
args[index] = assert(load("return \"" .. arg:gsub('"', [[\"]]) .. "\""))()
end
end
io.write(table.concat(args," "))
if not options.n then
io.write("\n")
end