-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.sh
34 lines (28 loc) · 1.01 KB
/
config.sh
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
#!/bin/bash
# -----------------------------
# Module: config.sh
# Description: Configures environment settings
# -----------------------------
configure_environment() {
print_status "Configuring environment settings..."
# Ensure the shell RC file exists
if [ ! -f "$RC_FILE" ]; then
touch "$RC_FILE"
print_status "Created shell configuration file: $RC_FILE"
fi
# Add environment variables if not present
if ! grep -q "# Go environment variables" "$RC_FILE"; then
{
echo ""
echo "# Go environment variables"
echo 'export GOPATH=$HOME/go'
echo 'export PATH=$PATH:/usr/local/go/bin:$GOPATH/bin'
} >> "$RC_FILE"
print_success "Go environment variables added to $RC_FILE."
else
print_success "Go environment variables already exist in $RC_FILE."
fi
# Inform the user to reload the shell
print_status "Please reload your shell or run 'source $RC_FILE' to apply the changes."
}
configure_environment