2023-10-09 17:56:28 +02:00
|
|
|
function ssh-export --description "Export SSH keys and config to a zip archive."
|
2023-10-08 19:41:13 +02:00
|
|
|
# Save the entry directory
|
2023-10-08 19:43:22 +02:00
|
|
|
set entry_directory "$PWD"
|
2023-10-08 19:41:13 +02:00
|
|
|
|
|
|
|
# Create the archive
|
2023-10-08 19:56:59 +02:00
|
|
|
set output_file "$HOME/ssh_keys.zip"
|
2023-10-08 19:43:22 +02:00
|
|
|
cd "$HOME/.ssh"
|
2023-10-08 19:56:59 +02:00
|
|
|
zip "$output_file" * -x 'known_hosts*' -x environment
|
2023-10-08 19:41:13 +02:00
|
|
|
|
|
|
|
# Returns to the entry directory
|
2023-10-08 19:43:22 +02:00
|
|
|
cd "$entry_directory"
|
2023-10-08 19:56:59 +02:00
|
|
|
|
|
|
|
echo "Exported at $output_file."
|
2023-10-08 19:41:13 +02:00
|
|
|
end
|