mirror of
https://github.com/rwinkhart/artix-install-script.git
synced 2026-08-28 04:46:27 -04:00
Make histclean show changes in file size, remove itself from history
This commit is contained in:
@@ -1,11 +1,14 @@
|
|||||||
#!/usr/bin/env zsh
|
#!/usr/bin/env zsh
|
||||||
|
|
||||||
|
echo 'Starting history size:'
|
||||||
|
ls -lh ~/.cache/zsh-histfile | cut -d " " -f5
|
||||||
|
|
||||||
hist=()
|
hist=()
|
||||||
|
|
||||||
while IFS= read -r line; do
|
while IFS= read -r line; do
|
||||||
if [[ $line == "./"* || $line == "/"* ]]; then
|
if [[ $line == "./"* || $line == "/"* ]]; then
|
||||||
hist+=($line)
|
hist+=($line)
|
||||||
else
|
elif [[ $line != "histclean" ]]; then
|
||||||
which $(echo $line | cut -d " " -f1) > /dev/null
|
which $(echo $line | cut -d " " -f1) > /dev/null
|
||||||
[[ $? == 0 ]] && hist+=($line)
|
[[ $? == 0 ]] && hist+=($line)
|
||||||
fi
|
fi
|
||||||
@@ -15,3 +18,6 @@ echo -n "" > "$XDG_CACHE_HOME"/zsh-histfile
|
|||||||
for item in "${hist[@]}"; do
|
for item in "${hist[@]}"; do
|
||||||
echo "$item" >> "$XDG_CACHE_HOME"/zsh-histfile
|
echo "$item" >> "$XDG_CACHE_HOME"/zsh-histfile
|
||||||
done
|
done
|
||||||
|
|
||||||
|
echo 'Ending history size:'
|
||||||
|
ls -lh ~/.cache/zsh-histfile | cut -d " " -f5
|
||||||
|
|||||||
Reference in New Issue
Block a user