forked from weimeilin79/companion-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinit.sh
More file actions
31 lines (21 loc) · 641 Bytes
/
Copy pathinit.sh
File metadata and controls
31 lines (21 loc) · 641 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
#!/bin/bash
# --- Function for error handling ---
handle_error() {
echo "Error: $1"
exit 1
}
# --- Part 1: Set Google Cloud Project ID ---
PROJECT_FILE="$HOME/project_id.txt"
echo "--- Setting Google Cloud Project ID File ---"
read -p "Please enter your Google Cloud project ID: " user_project_id
if [[ -z "$user_project_id" ]]; then
handle_error "No project ID was entered."
fi
echo "You entered: $user_project_id"
echo "$user_project_id" > "$PROJECT_FILE"
if [[ $? -ne 0 ]]; then
handle_error "Failed saving your project ID: $user_project_id."
fi
echo "Successfully saved project ID."
echo "--- Setup complete ---"
exit 0