proxmark3/client/luascripts/cmdline.lua

20 lines
523 B
Lua
Raw Normal View History

2019-09-04 23:36:23 +02:00
#!/usr/bin/env -S pm3 -l
2019-05-07 22:48:18 +02:00
--[[
A sampe script file on how to implement at cmd line inteface.
2019-09-04 23:36:23 +02:00
It also demonstrates how the script can be used with a shebang.
2019-05-07 22:48:18 +02:00
--]]
print("This is how a cmd-line interface could be implemented\nPrint 'exit' to exit.\n")
local answer
repeat
2019-03-09 10:34:43 +01:00
io.write("$>")
io.flush()
2019-05-07 22:48:18 +02:00
answer = io.read()
2019-03-09 10:34:43 +01:00
if answer ~= 'exit' then
local func = assert(loadstring("return " .. answer))
io.write("\n"..tostring(func() or "").."\n");
end--]]
2019-05-07 22:48:18 +02:00
until answer == "exit"
print("Bye\n");