From ec0757b2c902846407bd51aa8d8fc4ba7ff5fde0 Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Tue, 9 Sep 2014 23:08:38 -0400 Subject: [PATCH] Hooks - Added example of spelling correction via hook script. --- scripts/hooks/on-add.the | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 scripts/hooks/on-add.the diff --git a/scripts/hooks/on-add.the b/scripts/hooks/on-add.the new file mode 100644 index 000000000..64ac0209d --- /dev/null +++ b/scripts/hooks/on-add.the @@ -0,0 +1,19 @@ +#!/bin/bash + +read new_task + +re='(.*)([Tt])eh(.*)' +if [[ $new_task =~ $re ]] +then + while [[ $new_task =~ $re ]] + do + new_task=${BASH_REMATCH[1]}${BASH_REMATCH[2]}he${BASH_REMATCH[3]} + done + + echo "Auto-corrected 'teh' --> 'the'" +fi + +echo $new_task +exit 0 + +