aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/%HOME%/.bash_profile
blob: 8615e60e830d0334ab6bd8331de9e2b6de315823 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
[ -r "$HOME/.bashrc" ] && source "$HOME/.bashrc"

echo "Welcome to $( hostname )"

spawn_ssh_agent() {
    local rm_ssh_agent
    local output_path="$HOME/.ssh_agent.sh"
    [ -z "${SSH_AGENT_PID:+x}" ] \
        && command -v ssh-agent > /dev/null 2>&1 \
        && touch -- "$output_path" \
        && chmod 0600 -- "$output_path" \
        && ssh-agent -s > "$output_path" \
        && source "$output_path" > /dev/null \
        && [ -n "${SSH_AGENT_PID:+x}" ] \
        && echo "Spawned ssh-agent with PID: $SSH_AGENT_PID." \
        && command -v printf > /dev/null 2>&1 \
        && rm_ssh_agent="$( printf -- 'kill %q' "$SSH_AGENT_PID" )" \
        && trap "$rm_ssh_agent" EXIT
}

spawn_ssh_agent