22 lines
390 B
Plaintext
22 lines
390 B
Plaintext
#!/usr/bin/env luash
|
|
|
|
-- Environment variables (clean syntax)
|
|
print("Hello " .. $USER .. "!")
|
|
|
|
-- Variable assignment
|
|
$MY_VAR = "some value"
|
|
|
|
-- Shell commands with backticks
|
|
files = `ls -la`
|
|
current_dir = `pwd`
|
|
|
|
-- Interactive commands
|
|
!ls
|
|
|
|
-- The power of Lua + shell
|
|
if `test -f README.md` ~= "" then
|
|
lines = `wc -l < README.md`
|
|
print("README has " .. lines .. " lines")
|
|
end
|
|
|