From 345d4fa14606d043e085681e4e08c176625b418f Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Thu, 16 May 2024 19:46:19 +0000 Subject: [PATCH] ref(ssh-pubkey): prefer ~ over $HOME for unquoted paths --- ssh-pubkey/ssh-pubkey | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/ssh-pubkey/ssh-pubkey b/ssh-pubkey/ssh-pubkey index 84e47da..eaa5e93 100644 --- a/ssh-pubkey/ssh-pubkey +++ b/ssh-pubkey/ssh-pubkey @@ -4,29 +4,29 @@ set -u main() { - if [ ! -d "$HOME/.ssh" ]; then - mkdir -p "$HOME/.ssh/" - chmod 0700 "$HOME/.ssh/" + if [ ! -d ~/.ssh ]; then + mkdir -p ~/.ssh/ + chmod 0700 ~/.ssh/ fi - if [ ! -f "$HOME/.ssh/config" ]; then + if [ ! -f ~/.ssh/config ]; then # for the benefit of VSCode - touch "$HOME/.ssh/config" - chmod 0644 "$HOME/.ssh/config" + touch ~/.ssh/config + chmod 0644 ~/.ssh/config fi - if [ ! -f "$HOME/.ssh/authorized_keys" ]; then - touch "$HOME/.ssh/authorized_keys" - chmod 0600 "$HOME/.ssh/authorized_keys" + if [ ! -f ~/.ssh/authorized_keys ]; then + touch ~/.ssh/authorized_keys + chmod 0600 ~/.ssh/authorized_keys fi - if [ ! -f "$HOME/.ssh/id_rsa" ]; then - ssh-keygen -b 2048 -t rsa -f "$HOME/.ssh/id_rsa" -q -N "" + if [ ! -f ~/.ssh/id_rsa ]; then + ssh-keygen -b 2048 -t rsa -f ~/.ssh/id_rsa -q -N "" echo >&2 "" fi - if [ ! -f "$HOME/.ssh/id_rsa.pub" ]; then - ssh-keygen -y -f "$HOME/.ssh/id_rsa" > "$HOME/.ssh/id_rsa.pub" + if [ ! -f ~/.ssh/id_rsa.pub ]; then + ssh-keygen -y -f ~/.ssh/id_rsa > ~/.ssh/id_rsa.pub echo >&2 "" fi