mirror of
https://github.com/LukeSmithxyz/voidrice.git
synced 2026-03-20 01:37:45 +01:00
Added a new script
This commit is contained in:
parent
08d556cd4b
commit
c6eb8546ba
@ -1,4 +1,4 @@
|
||||
# Config for the Zoomer Shell
|
||||
#Config for the Zoomer Shell
|
||||
|
||||
# Enable colors and change prompt:
|
||||
autoload -U colors && colors # Load colors
|
||||
@ -9,7 +9,7 @@ stty stop undef # Disable ctrl-s to freeze terminal.
|
||||
# History in cache directory:
|
||||
HISTSIZE=10000
|
||||
SAVEHIST=10000
|
||||
HISTFILE=~/.cache/zsh/history
|
||||
HISTFILE=${XDG_CONFIG_HOME:-$HOME/.config}/zsh/history
|
||||
|
||||
# Load aliases and shortcuts if existent.
|
||||
[ -f "${XDG_CONFIG_HOME:-$HOME/.config}/shortcutrc" ] && source "${XDG_CONFIG_HOME:-$HOME/.config}/shortcutrc"
|
||||
|
||||
17
.local/bin/delete_certain_known_hosts
Executable file
17
.local/bin/delete_certain_known_hosts
Executable file
@ -0,0 +1,17 @@
|
||||
#!/bin/bash
|
||||
# Deletes certain lines of ~/.ssh/known_hosts
|
||||
known_hosts_path=~/.ssh/known_hosts
|
||||
lines_in_known_hosts=$(wc -l "$known_hosts_path" | awk '{print $1}')
|
||||
IFS=' '
|
||||
deduped_args=$(echo "$@" | xargs -n1 | sort -nu | xargs)
|
||||
read -r -a delete_these_lines <<< "$deduped_args"
|
||||
lines_to_delete=""
|
||||
for var in "${delete_these_lines[@]}"; do
|
||||
if [[ "$var" -gt "$lines_in_known_hosts" ]]; then
|
||||
echo "$var isnt valid line in $lines_in_known_hosts line $known_hosts_path"
|
||||
else
|
||||
lines_to_delete+="${var}d;"
|
||||
fi
|
||||
done
|
||||
sed -i "$lines_to_delete" "$known_hosts_path"
|
||||
echo "Deleted lines $(echo $(echo $lines_to_delete | sed 's/d;/, /g') | sed 's/.$//' )"
|
||||
Loading…
x
Reference in New Issue
Block a user