#!/bin/bash
# Delete an authorized_keys entry. Specify the line number (from catkeys) to delete.

if [ $# -ne 1 ]; then
	echo "Syntax: $0 <line number>" >&2
	exit 1
fi

line_no="$1"

if ! [[ $line_no =~ ^[0-9]+$ ]]; then
	echo "Argument must be a number" >&2
	exit 1
fi

sed -i "$line_no"d "$HOME/.ssh/authorized_keys"

echo "New keys:"
"$HOME"/git-shell-commands/catkeys
