Skip to content

Commit

Permalink
fix get_ssh_key script
Browse files Browse the repository at this point in the history
  • Loading branch information
bartekpacia committed Nov 18, 2023
1 parent 22f24ee commit ee8fe04
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions bin/get_ssh_key
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,18 @@ set -euo pipefail
# Example usage:
# $ get_ssh_key "id_rsa_raspi"

key_name="{$1:-}"
key_name="${1:-}"

if [ -z "$key_name" ]; then
echo "key_name not passed. Nothing was done."
return 1
echo "key_name not passed as argument. Nothing was done."
exit 1
fi

key_path="$HOME/.ssh/$key_name"

if [ -f "$key_path" ]; then
echo "$key_path already exists. Nothing was done to it."
else
op get document "$key_name" >"$key_path" && chmod 400 "$key_path"
exit 2
fi

op document get "$key_name" >"$key_path" && chmod 400 "$key_path"

0 comments on commit ee8fe04

Please sign in to comment.