Compare commits

..

5 Commits

Author SHA1 Message Date
7ef616df92 Laptop Test 2026-05-07 05:55:29 -07:00
41c53e86ec Experimentation 2026-05-05 21:57:20 -07:00
54666fd55c random number test in Lua - E and J helped 2026-05-05 10:16:00 -07:00
4c74a07eb6 random number test in bash 2026-05-05 08:12:46 -07:00
f34be20aa1 Placeholder scripts added 2026-05-05 07:29:06 -07:00
7 changed files with 85 additions and 2 deletions

21
bash/randTest.sh Executable file
View File

@@ -0,0 +1,21 @@
#!/usr/bin/env bash
# set script restart
script=$(readlink -f "$0")
# Select number
echo "Pick a number:"
read num
# Output response
echo "The random number is $((1 + $RANDOM % $num))."
# Ask to run again
echo "Run script again (yes/no)?"
read answer
if [ "$answer" = yes ]
then exec "$script"
fi
echo "Exiting"
exit 0

0
delete.test Normal file
View File

BIN
lua/Notes/help1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 77 KiB

10
lua/randTest.lua Normal file
View File

@@ -0,0 +1,10 @@
io.write("Pick a number: ")
local number = io.read("*n")
local randnum = math.random(1, number)
print("The number is ", randnum)
-- ask to rerun script
print("Run again (y/n)?")
local cmd = io.read()
if cmd == "y" then
dofile("randTest.lua")
else end

View File

@@ -0,0 +1,26 @@
-- Assistance from a friend
-- Instantiate all the things
local run = true
local cmd, number, randnum
-- Start a loop
while run == true do
-- Get the users initial number
io.write("Pick a number: ")
number = io.read("*n")
-- Do some mathemagic
-- randnum = math.random(1, number)
print("The random number is ", math.random(1, number))
-- Ask to rerun script
io.read()
print("Run again (Y/n)?")
cmd = io.read("*l")
-- Exit if the user doesn't want to go again
if string.lower(cmd) ~= "y" then
run = false
end
end

26
lua/randTestHelped.lua Normal file
View File

@@ -0,0 +1,26 @@
-- Assistance from a friend
-- Instantiate all the things
local run = true
local cmd, number, randnum
-- Start a loop
while run == true do
-- Get the users initial number
io.write("Pick a number: ")
number = io.read("*n")
-- Do some mathemagic
randnum = math.random(1, number)
print("The random number is ", randnum)
-- Ask to rerun script
io.read()
print("Run again (Y/n)?")
cmd = io.read("*l")
-- Exit if the user doesn't want to go again
if string.lower(cmd) ~= "y" then
run = false
end
end