diff options
author | Egor Tensin <Egor.Tensin@gmail.com> | 2018-06-04 23:30:25 +0300 |
---|---|---|
committer | Egor Tensin <Egor.Tensin@gmail.com> | 2018-06-04 23:30:25 +0300 |
commit | dc5914816bf4d8afbeccc4fae3f77dff304187b9 (patch) | |
tree | d33fa11cd233f27ae78fe55c20eb51abb6f41c42 /%HOME% | |
parent | .bashrc: don't source missing files (diff) | |
download | linux-home-dc5914816bf4d8afbeccc4fae3f77dff304187b9.tar.gz linux-home-dc5914816bf4d8afbeccc4fae3f77dff304187b9.zip |
ssh.sh: move to .profile
Diffstat (limited to '')
-rw-r--r-- | %HOME%/.bash_utils/ssh.sh | 23 | ||||
-rw-r--r-- | %HOME%/.bashrc | 3 | ||||
-rw-r--r-- | %HOME%/.profile | 18 |
3 files changed, 20 insertions, 24 deletions
diff --git a/%HOME%/.bash_utils/ssh.sh b/%HOME%/.bash_utils/ssh.sh deleted file mode 100644 index fa92088..0000000 --- a/%HOME%/.bash_utils/ssh.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/usr/bin/env bash - -# Copyright (c) 2018 Egor Tensin <Egor.Tensin@gmail.com> -# This file is part of the "Linux/Cygwin environment" project. -# For details, see https://github.com/egor-tensin/linux-home. -# Distributed under the MIT License. - -kill_ssh_agent() { - [ -n "${SSH_AGENT_PID:+x}" ] && kill "$SSH_AGENT_PID" -} - -spawn_ssh_agent() { - local output - [ -z "${SSH_AGENT_PID:+x}" ] \ - && command -v ssh-agent > /dev/null 2>&1 \ - && output="$( ssh-agent -s )" \ - && eval "$output" > /dev/null \ - && [ -n "${SSH_AGENT_PID:+x}" ] \ - && echo "Spawned ssh-agent with PID: $SSH_AGENT_PID." \ - && trap kill_ssh_agent EXIT -} - -alias ssh-copy-id='ssh-copy-id -i' diff --git a/%HOME%/.bashrc b/%HOME%/.bashrc index 0648a75..7df126d 100644 --- a/%HOME%/.bashrc +++ b/%HOME%/.bashrc @@ -49,6 +49,8 @@ alias cls='echo -en "\ec"' alias copy='xclip -sel clip' +alias ssh-copy-id='ssh-copy-id -i' + [ -r "$HOME/.bash_utils/file.sh" ] && source "$HOME/.bash_utils/file.sh" [ -r "$HOME/.bash_utils/text.sh" ] && source "$HOME/.bash_utils/text.sh" @@ -58,7 +60,6 @@ alias copy='xclip -sel clip' [ -r "$HOME/.bash_utils/mysql.sh" ] && source "$HOME/.bash_utils/mysql.sh" [ -r "$HOME/.bash_utils/os.sh" ] && source "$HOME/.bash_utils/os.sh" [ -r "$HOME/.bash_utils/path.sh" ] && source "$HOME/.bash_utils/path.sh" -[ -r "$HOME/.bash_utils/ssh.sh" ] && source "$HOME/.bash_utils/ssh.sh" [ -r "$HOME/.bashrc_work" ] && source "$HOME/.bashrc_work" diff --git a/%HOME%/.profile b/%HOME%/.profile index 401947b..b1e7153 100644 --- a/%HOME%/.profile +++ b/%HOME%/.profile @@ -59,3 +59,21 @@ python_setup() { python_setup python3 python [ -r "$HOME/.pythonrc" ] && export PYTHONSTARTUP="$HOME/.pythonrc" + +# ssh-agent + +kill_ssh_agent() { + [ -n "${SSH_AGENT_PID:+x}" ] && kill "$SSH_AGENT_PID" +} + +spawn_ssh_agent() { + local output + [ -z "${SSH_AGENT_PID:+x}" ] \ + && command -v ssh-agent > /dev/null 2>&1 \ + && output="$( ssh-agent -s )" \ + && eval "$output" > /dev/null \ + && [ -n "${SSH_AGENT_PID:+x}" ] \ + && trap kill_ssh_agent EXIT +} + +spawn_ssh_agent |