diff --git a/menu.sh b/menu.sh new file mode 100644 index 0000000..229fb11 --- /dev/null +++ b/menu.sh @@ -0,0 +1,93 @@ +#!/bin/bash +export TERM=xterm +trap "clear; exit" INT TERM + +GAMES_DIR="/usr/games" + +while true; do + clear +cat <<'EOF' + ++------------------------------------------------------------------------+ +| | +| / \ ___ ___(_|_) / \ _ __ ___ __ _ __| | ___ | +| / _ \ / __|/ __| | | / _ \ | '__/ __/ _` |/ _` |/ _ \ | +| / ___ \\__ \ (__| | | / ___ \| | | (_| (_| | (_| | __/ | +| /_/ \_\___/\___|_|_| /_/ \_\_| \___\__,_|\__,_|\___| | +| | +| Classic ASCII Arcade – ASCII Never Dies | +| | +| 1. Nethack 6. ninvaders | +| 2. Moon Buggy 7. 2048 | +| 3. Bastet 8. Pacman | +| 4. Greed 9. Sudoku | +| 5. nsnake 10. moore games | +| 11. Starshell 12. Quit | ++------------------------------------------------------------------------+ +EOF + + read -rp "Choose a game [1-11]: " choice + + case "$choice" in + 1) /usr/games/nethack ;; + 2) /usr/games/moon-buggy ;; + 3) /usr/games/bastet ;; + 4) /usr/games/greed ;; + 5) /usr/games/nsnake ;; + 6) /usr/games/ninvaders ;; + 7) /usr/games/2048 ;; + 8) /usr/games/pacman4console ;; + 9) /usr/games/nudoku ;; + + 10) + # BSDGames Prompt + while true; do + clear + echo "🎲 More games from BSDGames" + echo + echo "Type the name of a game (e.g. snake, tetris, hangman)" + echo "Type 'list' to show all available games, or 'back' to return to the main menu." + echo + + read -rp "Game name: " g + + case "$g" in + exit|quit|back) break ;; + list) + echo + echo "Available games:" + echo + i=0 + for file in "$GAMES_DIR"/*; do + if [[ -f "$file" && -x "$file" ]]; then + printf "%s " "$(basename "$file")" + ((i++)) + if (( i % 5 == 0 )); then echo; fi + fi + done + echo + echo + read -rp "Press Enter to continue..." ;; + *) + if [[ -x "$GAMES_DIR/$g" ]]; then + echo "Launching $g..." + echo + "$GAMES_DIR/$g" + else + echo "❌ Game '$g' not found or not executable." + fi + echo + read -rp "Press Enter to return..." + ;; + esac + done + ;; + 11) /home/arcade/starshell/starshell/starshell ;; + 12) exit 0 ;; + *) echo "Invalid choice" ;; + esac + + echo + echo "Press Enter to return to the menu..." + read -r +done