confOS/.config/fish/functions/ssh-export.fish

15 lines
394 B
Fish
Raw Normal View History

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
set output_file "$HOME/ssh_keys.zip"
2023-10-08 19:43:22 +02:00
cd "$HOME/.ssh"
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"
echo "Exported at $output_file."
2023-10-08 19:41:13 +02:00
end