X-Git-Url: https://git.josue.xyz/?a=blobdiff_plain;f=ssh-utils%2Fssh-pubkey.sh;h=40b09faa281dedd74d47ef6d870fd0bee9ce958c;hb=14f590f5a5ba9f614843441a0f752c2754b47f84;hp=ed5c345aaa91b472414338ea12ecd1d482b15308;hpb=c25c0354ea27568a04315b820d0ccd26bdea0264;p=webi-installers%2F.git diff --git a/ssh-utils/ssh-pubkey.sh b/ssh-utils/ssh-pubkey.sh index ed5c345..40b09fa 100644 --- a/ssh-utils/ssh-pubkey.sh +++ b/ssh-utils/ssh-pubkey.sh @@ -1,8 +1,8 @@ #!/bin/bash +set -e +set -u -{ - set -e - set -u +function _ssh_pubkey() { if [ ! -d "$HOME/.ssh" ]; then mkdir -p "$HOME/.ssh/" @@ -22,20 +22,23 @@ if [ ! -f "$HOME/.ssh/id_rsa" ]; then ssh-keygen -b 2048 -t rsa -f "$HOME/.ssh/id_rsa" -q -N "" - >&2 echo "" + echo >&2 "" fi if [ ! -f "$HOME/.ssh/id_rsa.pub" ]; then ssh-keygen -y -f "$HOME/.ssh/id_rsa" > "$HOME/.ssh/id_rsa.pub" - >&2 echo "" + echo >&2 "" fi # TODO use the comment (if any) for the name of the file - >&2 echo "" - >&2 echo "~/Downloads/id_rsa.$(whoami).pub": - >&2 echo "" + echo >&2 "" + #shellcheck disable=SC2088 + echo >&2 "~/Downloads/id_rsa.$(whoami).pub": + echo >&2 "" rm -f "$HOME/Downloads/id_rsa.$(whoami).pub" cp -r "$HOME/.ssh/id_rsa.pub" "$HOME/Downloads/id_rsa.$(whoami).pub" cat "$HOME/Downloads/id_rsa.$(whoami).pub" - >&2 echo "" + echo >&2 "" } + +_ssh_pubkey