Add menuIP.sh script to create an interactive menu for checking external IP, listing directory contents, and pinging Google. Enhances user experience with clear prompts and options.
This commit is contained in:
40
menuIP.sh
Normal file
40
menuIP.sh
Normal file
@@ -0,0 +1,40 @@
|
||||
#!/bin/bash
|
||||
|
||||
while true; do
|
||||
clear
|
||||
echo "==============================="
|
||||
echo " MAIN MENU "
|
||||
echo "==============================="
|
||||
echo "1. Check your external IP"
|
||||
echo "2. List directory contents"
|
||||
echo "3. Ping google.com (5 times)"
|
||||
echo "4. Exit"
|
||||
echo "-------------------------------"
|
||||
read -p "Enter option number: " option
|
||||
case $option in
|
||||
1)
|
||||
echo
|
||||
echo "Your external IP is:"
|
||||
curl -s https://api.ipify.org
|
||||
;;
|
||||
2)
|
||||
echo
|
||||
echo "Directory contents:"
|
||||
ls -la
|
||||
;;
|
||||
3)
|
||||
echo
|
||||
echo "Pinging google.com (5 times):"
|
||||
ping -c 5 google.com
|
||||
;;
|
||||
4)
|
||||
echo "Exiting..."
|
||||
break
|
||||
;;
|
||||
*)
|
||||
echo "Invalid option. Please try again."
|
||||
;;
|
||||
esac
|
||||
echo
|
||||
read -p "Press Enter to continue..."
|
||||
done
|
||||
Reference in New Issue
Block a user