add a couple shell programs

This commit is contained in:
Ryan T
2026-02-20 15:23:46 -05:00
parent 371954373e
commit 149fb18564
4 changed files with 34 additions and 0 deletions

View File

@@ -0,0 +1,2 @@
local args = {...}
print(table.concat(args, " "))

View File

@@ -0,0 +1,23 @@
local args = {...}
local name = syscall.getTask(syscall.getpid()).name
if #args == 0 then
print(name..": Missing operand.")
return
end
local fs = require("sys.fs")
local newDir = args[1]
if newDir:sub(1, 1) ~= "/" then
newDir = syscall.getcwd().."/"..newDir
end
if newDir:sub(#newDir, #newDir) ~= "/" then
newDir = newDir.."/"
end
if fs.isDir(newDir) then
print(name..": Cannot create directory '"..args[1].."': Directory already exists.")
return
end
fs.mkdir(newDir)

View File

@@ -0,0 +1 @@
print((syscall.getUsername() or "Unknown"))

View File

@@ -0,0 +1,8 @@
local args = {...}
while true do
if #args == 0 then
print("y")
else
print(table.concat(args, " "))
end
end