From 149fb185643a9fef5ce694b556836008656811fe Mon Sep 17 00:00:00 2001 From: Ryan T Date: Fri, 20 Feb 2026 15:23:46 -0500 Subject: [PATCH] add a couple shell programs --- Src/Hyperion-bash/bin/echo | 2 ++ Src/Hyperion-bash/bin/mkdir | 23 +++++++++++++++++++++++ Src/Hyperion-bash/bin/whoami | 1 + Src/Hyperion-bash/bin/yes | 8 ++++++++ 4 files changed, 34 insertions(+) create mode 100644 Src/Hyperion-bash/bin/echo create mode 100644 Src/Hyperion-bash/bin/mkdir create mode 100644 Src/Hyperion-bash/bin/whoami create mode 100644 Src/Hyperion-bash/bin/yes diff --git a/Src/Hyperion-bash/bin/echo b/Src/Hyperion-bash/bin/echo new file mode 100644 index 0000000..7b5a803 --- /dev/null +++ b/Src/Hyperion-bash/bin/echo @@ -0,0 +1,2 @@ +local args = {...} +print(table.concat(args, " ")) \ No newline at end of file diff --git a/Src/Hyperion-bash/bin/mkdir b/Src/Hyperion-bash/bin/mkdir new file mode 100644 index 0000000..025a830 --- /dev/null +++ b/Src/Hyperion-bash/bin/mkdir @@ -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) \ No newline at end of file diff --git a/Src/Hyperion-bash/bin/whoami b/Src/Hyperion-bash/bin/whoami new file mode 100644 index 0000000..3d832ca --- /dev/null +++ b/Src/Hyperion-bash/bin/whoami @@ -0,0 +1 @@ +print((syscall.getUsername() or "Unknown")) \ No newline at end of file diff --git a/Src/Hyperion-bash/bin/yes b/Src/Hyperion-bash/bin/yes new file mode 100644 index 0000000..9490c89 --- /dev/null +++ b/Src/Hyperion-bash/bin/yes @@ -0,0 +1,8 @@ +local args = {...} +while true do + if #args == 0 then + print("y") + else + print(table.concat(args, " ")) + end +end \ No newline at end of file