Skip to content

Commit b615642

Browse files
committed
# ✅ How to Run OpenLinks.sh on macOS
This guide helps you run the `OpenLinks.sh` script that opens Java documentation links from the terminal. --- ## 📁 1. Navigate to the Script Folder Open Terminal and go to the folder where the script is saved: ```bash cd "/Users/somesh/Java SE/JavaEvolution-Learning-Growing-Mastering/Section6StringClassPrinting" ``` > ✅ Tip: You can also drag the folder into the Terminal to auto-fill the path. --- ## 🔐 2. Give Execute Permission (One-Time Setup) Run this command to make the script executable: ```bash chmod +x OpenLinks.sh ``` --- ## ▶️ 3. Run the Script Now run the script with: ```bash ./OpenLinks.sh ``` You’ll see a menu with options to open the Java documentation in your browser. --- ## 📌 Notes - Use number keys (1 or 2) to make a selection. - The `open` command automatically launches your macOS default web browser. Signed-off-by: Somesh diwan <[email protected]>
1 parent 4d49764 commit b615642

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#!/bin/bash
2+
3+
# Save current directory and move to script's directory
4+
cd "$(dirname "$0")"
5+
6+
while true; do
7+
clear
8+
echo "============================================================"
9+
echo " Java - StringBuilder Documentation"
10+
echo "============================================================"
11+
echo "1. StringBuilder Class (Java SE 8 API)"
12+
echo "2. Exit"
13+
echo
14+
read -p "Enter your choice [1-2]: " choice
15+
16+
case "$choice" in
17+
1)
18+
open "https://docs.oracle.com/javase/8/docs/api/java/lang/StringBuilder.html"
19+
;;
20+
2)
21+
echo "Goodbye!"
22+
break
23+
;;
24+
*)
25+
echo
26+
echo "Invalid choice. Please select 1 or 2."
27+
read -p "Press Enter to continue..."
28+
;;
29+
esac
30+
done

0 commit comments

Comments
 (0)