Last active
June 3, 2021 20:46
-
-
Save jasonsouza/f882e9c2b7a037a963fcf6aceb5e1965 to your computer and use it in GitHub Desktop.
Convert private SSH key for JSON value format
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Requires AWk and SED to be installed. | |
export SSH_FILE_PATH="$HOME/.ssh/id_rsa" #replace this with path to your private SSH key | |
line_count=`wc -l ${SSH_FILE_PATH} | awk '{print $1}'` | |
last_new_line=`expr $line_count - 1` | |
cat $SSH_FILE_PATH | sed '1s/$/\\n/' | sed ""$last_new_line"s/$/\\\n/" | tr -d '\n' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment