Add existing scripts
This commit is contained in:
1 parent
2ab5a42c2b
commit
3c05d74104
31 files changed
+1138
No files matched your search
Executable
+19
@@ -0,0 +1,19 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Create an empty array to store random numbers
|
||||
random_numbers=()
|
||||
|
||||
# As long as the length of the array is less than 5, continue to loop
|
||||
while [ ${#random_numbers[@]} -lt 5 ]
|
||||
do
|
||||
# Get a random number; ask the user if they want to add it to the array
|
||||
random_number=$RANDOM
|
||||
read -p "Add $random_number to the list? (y/n): " choice
|
||||
|
||||
# If the user chose "y", add the random number to the array
|
||||
if [ "$choice" = "y" ]; then random_numbers+=($random_number); fi
|
||||
done
|
||||
|
||||
# Show the contents of the array
|
||||
echo "Random Numbers: ${random_numbers[@]}"
|
||||
|
||||
Reference in new issue
Block a user