Skip to content

Instantly share code, notes, and snippets.

@Sanix-Darker
Created April 4, 2023 00:28
Show Gist options
  • Save Sanix-Darker/5166519cbca0052dac03b25efa221255 to your computer and use it in GitHub Desktop.
Save Sanix-Darker/5166519cbca0052dac03b25efa221255 to your computer and use it in GitHub Desktop.
#!/bin/bash
# run a command again and again only if the standard output hash change by a single bit
# _inf git status
_inf(){
echo "Executing '$@' until the output change or you quit:"
# we source our alias first
PREVIOUS_HASH=""
while true; do
CURRENT_HASH=$($(echo "${@}") | md5sum)
if [ "$CURRENT_HASH" != "$PREVIOUS_HASH" ]; then
$(echo "${@}");
echo -e "----------------------------------";
PREVIOUS_HASH=$CURRENT_HASH
sleep 1;
fi;
sleep 0.5; # to keep our cpu sane
done;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment