Skip to content

Latest commit

 

History

History
42 lines (31 loc) · 814 Bytes

sh.md

File metadata and controls

42 lines (31 loc) · 814 Bytes

Shell

local sh = require "sh"
sh.run(...)

Runs the command ... with os.execute.

sh.read(...)

Runs the command ... with io.popen. When sh.read succeeds, it returns the content of stdout. Otherwise it returns the error identified by io.popen.

sh.write(...)(data)

Runs the command ... with io.popen and feeds stdin with data. sh.write returns the same values returned by os.execute.

sh.pipe(...)(data)

Runs the command ... with io.popen or pandoc.pipe and feeds stdin with data. When sh.pipe succeeds, it returns the content of stdout. Otherwise it returns the error identified by op.popen or pandoc.pipe.

sh(...)

sh can be called as a function. sh(...) is a shortcut to sh.read(...).