mirror of
https://github.com/rwinkhart/artix-install-script.git
synced 2026-08-28 04:46:27 -04:00
Added script for removing invalid commands from zsh history file
This commit is contained in:
Executable
+17
@@ -0,0 +1,17 @@
|
||||
#!/usr/bin/env zsh
|
||||
|
||||
hist=()
|
||||
|
||||
while IFS= read -r line; do
|
||||
if [[ $line == "./"* || $line == "/"* ]]; then
|
||||
hist+=($line)
|
||||
else
|
||||
which $(echo $line | cut -d " " -f1) > /dev/null
|
||||
[[ $? == 0 ]] && hist+=($line)
|
||||
fi
|
||||
done < "$XDG_CACHE_HOME"/zsh-histfile
|
||||
|
||||
echo -n "" > "$XDG_CACHE_HOME"/zsh-histfile
|
||||
for item in "${hist[@]}"; do
|
||||
echo "$item" >> "$XDG_CACHE_HOME"/zsh-histfile
|
||||
done
|
||||
Reference in New Issue
Block a user