Skip to content

Instantly share code, notes, and snippets.

@robbestad
Created September 16, 2020 07:07
Show Gist options
  • Save robbestad/0b659f5ce16f8e209818e9cabc28589b to your computer and use it in GitHub Desktop.
Save robbestad/0b659f5ce16f8e209818e9cabc28589b to your computer and use it in GitHub Desktop.
#!/bin/sh
# Redirect output to stderr.
exec 1>&2
# enable user input
exec < /dev/tty
staged=' -U0'
cached=' --cached'
# CHECK
if test $(git diff $cached | egrep '^\+.*console\.log' | wc -l) != 0
then
echo "Funnet console.logs i følgende filer: "
exec git diff $cached | egrep '(^\+{3})|^\+.*console\.log.*' | egrep '(^\+{3})'
read -p "Vil du fortsette? (j/n)" yn
echo $yn | grep ^[YyJj]$
if [ $? -eq 0 ]
then
exit 0; #fortsett
else
exit 1; #stopp
fi
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment