Add knownrm function for deleting a line from known_hosts file.

This commit is contained in:
Jeff Geerling
2016-03-17 10:40:53 -05:00
parent 95f5b6baf5
commit 514f6c0a32
+10
View File
@@ -76,6 +76,16 @@ export ANSIBLE_NOCOWS=1
alias an='ansible' alias an='ansible'
alias ap='ansible-playbook' alias ap='ansible-playbook'
# Delete a given line number in the known_hosts file.
knownrm() {
re='^[0-9]+$'
if ! [[ $1 =~ $re ]] ; then
echo "error: line number missing" >&2;
else
sed -i '' "$1d" ~/.ssh/known_hosts
fi
}
# Ask for confirmation when 'prod' is in a command string. # Ask for confirmation when 'prod' is in a command string.
prod_command_trap () { prod_command_trap () {
if [[ $BASH_COMMAND == *prod* ]] if [[ $BASH_COMMAND == *prod* ]]