-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
38 lines (31 loc) · 945 Bytes
/
install.sh
File metadata and controls
38 lines (31 loc) · 945 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/bin/bash
# mark update.sh as executable
chmod +x update.sh
# List all folders in the current directory
echo "Available folders:"
folders=()
index=1
for dir in */; do
if [ -d "$dir" ]; then
folders+=("$dir")
echo "$index) $dir"
((index++))
fi
done
# Check if folders were found
if [ ${#folders[@]} -eq 0 ]; then
echo "No folders found in the current directory."
exit 1
fi
# Prompt the user to select a folder
read -p "Select a folder by number: " choice
# Validate the user's input
if ! [[ "$choice" =~ ^[0-9]+$ ]] || [ "$choice" -lt 1 ] || [ "$choice" -gt "${#folders[@]}" ]; then
echo "Invalid selection."
exit 1
fi
# Get the selected folder
folder="${folders[$choice-1]}"
# Find and make all .sh scripts in the selected folder and subfolders executable
find "$folder" -type f -name "*.sh" -exec chmod +x {} \;
echo "All .sh scripts in '$folder' and its subfolders are now executable."