Skip to content

Commit

Permalink
style: Put the campus selection into an array instead of a string
Browse files Browse the repository at this point in the history
  • Loading branch information
itislu committed May 22, 2024
1 parent 94b5faa commit 6da777f
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -165,18 +165,15 @@ if { [[ -z "$home_max_size" ]] || [[ $home_max_size -eq 0 ]]; } &&
# Create list of campuses in this format: n) Campus Name
i=1
for campus_name in "${campus_names[@]}"; do
prompt_campuses+="${bold}$(( i++ ))${reset}) $campus_name\n"
prompt_campuses+=("${bold}$(( i++ ))${reset}) $campus_name")
done

# Remove last newline
prompt_campuses="${prompt_campuses%\\n}"

# Prompt user
# Allow case-insensitive matching
shopt -s nocasematch
while true; do
pretty_print "${bold}Choose your campus:${reset}"
printf "%b\n" "$prompt_campuses"
printf "%b\n" "${prompt_campuses[@]}"
read -rp "> "

# Check if input is a valid number of the list
Expand Down

0 comments on commit 6da777f

Please sign in to comment.