23 lines
556 B
Bash
Executable File
23 lines
556 B
Bash
Executable File
#!/bin/bash
|
|
# This script adds the bin directory to PATH and loads environment variables from .env
|
|
#
|
|
# Usage:
|
|
# Source this script in your rc:
|
|
# source /path/to/here/install.sh
|
|
|
|
SCRIPT_DIR="$(dirname "$(realpath "$0")")"
|
|
BIN_DIR="$SCRIPT_DIR/bin"
|
|
ENV_FILE="$SCRIPT_DIR/.env"
|
|
|
|
if [ -d "$BIN_DIR" ]; then
|
|
export PATH="$PATH:$BIN_DIR"
|
|
fi
|
|
|
|
if [ -f "$ENV_FILE" ]; then
|
|
while IFS='=' read -r key value; do
|
|
if [ -n "$key" ] && [ -n "$value" ] && [[ ! "$key" =~ ^# ]]; then
|
|
export "$key=$value"
|
|
fi
|
|
done < "$ENV_FILE"
|
|
fi
|