Archives
Trending
Support
Login
clear text
XML
Django
JavaScript
MATLAB
C
C++
C#
Python
SQL
Shell
Bash
Markdown
YAML
JSON
HTML
CSS
PHP
Java
Ruby
Go
Rust
Swift
Kotlin
Arduino
TypeScript
Perl
Autohotkey
Lua
SQF
R
Scala
Haskell
Groovy
Dart
Clojure
VB.NET
Objective-C
PowerShell
Bash
CoffeeScript
Verilog
#!/bin/bash # bash based guessing game. # Define the game function function play_game() { echo "Welcome to the game!" echo "Guess a number between 1 and 100:" secret_number=$((1 + RANDOM % 100)) attempts=0 while true; do read -p "Enter your guess: " guess ((attempts++)) if [[ $guess -eq $secret_number ]]; then echo "Congratulations! You guessed the secret number in $attempts attempts." break elif [[ $guess -lt $secret_number ]]; then echo "Too low, try again." else echo "Too high, try again." fi done } # Call the game function play_game
Mark as private (unlisted)
for 30 minutes
for 6 hours
for 1 day
for 1 week
for 1 month
for 1 year
everlasting (like CCCP)