add a couple shell programs
This commit is contained in:
2
Src/Hyperion-bash/bin/echo
Normal file
2
Src/Hyperion-bash/bin/echo
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
local args = {...}
|
||||||
|
print(table.concat(args, " "))
|
||||||
23
Src/Hyperion-bash/bin/mkdir
Normal file
23
Src/Hyperion-bash/bin/mkdir
Normal 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)
|
||||||
1
Src/Hyperion-bash/bin/whoami
Normal file
1
Src/Hyperion-bash/bin/whoami
Normal file
@@ -0,0 +1 @@
|
|||||||
|
print((syscall.getUsername() or "Unknown"))
|
||||||
8
Src/Hyperion-bash/bin/yes
Normal file
8
Src/Hyperion-bash/bin/yes
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
local args = {...}
|
||||||
|
while true do
|
||||||
|
if #args == 0 then
|
||||||
|
print("y")
|
||||||
|
else
|
||||||
|
print(table.concat(args, " "))
|
||||||
|
end
|
||||||
|
end
|
||||||
Reference in New Issue
Block a user