zshrc: make ssh-agent smarter

This commit is contained in:
surtur 2022-03-26 00:35:47 +01:00
parent 57bb1e4504
commit 2763d0f256
Signed by: wanderer
GPG Key ID: 19CE1EC1D9E0486D

9
.zshrc

@ -125,7 +125,7 @@
alias zshconfig="vim ~/.zshrc"
alias zshist="vim ~/.zsh_history"
alias alltheconfigs='alltheconfigs.sh'
alias agentssh="ssh-agent -s && ssh-add ~/.ssh/$kee" # add development key on demand
alias agentssh="ssh-add ~/.ssh/$kee" # add development key on demand
alias rsync-copy='rsync -avz --progress -h'
alias rsync-move='rsync -avz --progress -h --remove-source-files'
alias rsync-synchronize='rsync -avzu --delete --progress -h'
@ -142,6 +142,13 @@
alias nmcs='nmcli conn show'
export DOCKER_HOST=unix://$XDG_RUNTIME_DIR/podman/podman.sock
if [ -z SSH_AGENT_PID ]; then
ssh-agent -s
if [ ! $(ssh-add -l | grep -q 'surtur (ED25519)') ]; then
agentssh
fi
fi
transfer() { if [ $# -eq 0 ]; then echo -e "No arguments specified. Usage:\necho transfer /tmp/test.md\ncat /tmp/test.md | transfer test.md"; return 1; fi;tmpfile=$( mktemp -t transferXXX ); if tty -s; then basefile=$(basename "$1" | sed -e 's/[^a-zA-Z0-9._-]/-/g'); curl --progress-bar --upload-file "$1" "https://transfer.sh/$basefile" >> $tmpfile; else curl --progress-bar --upload-file "-" "https://transfer.sh/$1" >> $tmpfile ; fi; cat $tmpfile; rm -f $tmpfile; }
info() { printf "\n%s %s\n\n" "$( date )" "$*" >&2; }