top of page
Shell Script to Ask User Favourite Games
Create a script that interacts with users about their favorite games.
In Linux bash shell script we can create a script to ask the user to input multiple entries and we can display a customized response after the user input. This will be achieved with a reading command to accept the entries and an echo command to display the entries with customizing options.
vi favourite_game.sh
# !/bin/bash
# Favourite Games
#Taking multiple inputs
echo "Type your Favourite Games"
read game1
read game2
read game3
read game4
read game5
read game6
echo "$game1 is your first choice"
echo "$game2 is your second choice"
echo "$game3 is your third choice"
echo "$game4 is your fourth choice"
echo "$game5 is your fifth choice"
echo "$game6 is your sixth choice"
Here is the sample output of the above script
More ways to the user multiple entries
You may use it where the user has more than one answers
You can ask the user to enter more than one input and evaluate their inputs with if-else and respond accordingly.
bottom of page