Add shell quoting and 'read -r' in example hooks

This helps to avoid interpretation of escape sequences, such as
backslash-escapes, in these values.

Patch provided by @bughunter2 in https://github.com/GothenburgBitFactory/taskwarrior/issues/3899.
This commit is contained in:
Dustin J. Mitchell 2025-06-23 16:34:05 -04:00
parent c594ecb58d
commit 03ec490913
No known key found for this signature in database
5 changed files with 12 additions and 12 deletions

View file

@ -1,12 +1,12 @@
#!/usr/bin/env bash
read new_task
read -r new_task
if (echo $new_task | grep -qE '[tT]eh');
if (echo "$new_task" | grep -qE '[tT]eh');
then
new_task=$(echo $new_task | sed -r 's/([tT])eh/\1he/g')
new_task=$(echo "$new_task" | sed -r 's/([tT])eh/\1he/g')
echo "Auto-corrected 'teh' --> 'the'"
fi
echo $new_task
echo "$new_task"
exit 0