diff --git a/sync_ssh.sh b/sync_ssh.sh index ff53b4c..e7cb1fd 100755 --- a/sync_ssh.sh +++ b/sync_ssh.sh @@ -1,7 +1,9 @@ #!/bin/sh +SSHDIR="$HOME/.ssh" + keys= -for x in $HOME/.ssh/*.pub; do +for x in $SSHDIR/*.pub; do if [ -s "$x" ]; then keys="$keys $x" else @@ -9,7 +11,7 @@ for x in $HOME/.ssh/*.pub; do fi done -ak="$HOME/.ssh/authorized_keys" +ak="$SSHDIR/authorized_keys" if [ -s "$ak" ]; then while read l; do found= @@ -25,7 +27,7 @@ if [ -s "$ak" ]; then if [ -z "$found" ]; then name="$(echo "$l" | cut -d' ' -f3)" if [ -n "$name" ]; then - echo "$l" > .ssh/$name.pub + echo "$l" > "$SSHDIR/$name.pub" fi fi done < $ak > $ak~ @@ -34,7 +36,7 @@ else for x in amery@geeks.cl \ amery@builder.geeks.cl \ amery@shell.easy-cloud.net; do - x="$HOME/.ssh/$x.pub" + x="$SSHDIR/$x.pub" [ -s "$x" ] || continue cat "$x" done > $ak~