Update 'clean-tw.sh'
The script is now safer and works for task ids bigger than 99!
This commit is contained in:
parent
90d18d7392
commit
c56f8995e1
1 changed files with 13 additions and 11 deletions
|
@ -4,8 +4,7 @@ function get_task_value {
|
||||||
echo "$task_data" | grep "^$1" | sed -E "s/^$1 +//"
|
echo "$task_data" | grep "^$1" | sed -E "s/^$1 +//"
|
||||||
}
|
}
|
||||||
|
|
||||||
ids=$(task limit:none recur | grep -E '^ +[[:digit:]].*[[:alpha:]].*[[:digit:]]$' | sed -E 's/^ +([[:digit:]]+) .*/\1/')
|
ids=$(task limit:none recur | grep -E '^ ?[[:digit:]].*[[:alpha:]].*[[:digit:]]$' | sed -E 's/^ ?([[:digit:]]+) .*/\1/')
|
||||||
|
|
||||||
excluded_ids=$(for id in $ids
|
excluded_ids=$(for id in $ids
|
||||||
do
|
do
|
||||||
task_data="$(task $id)"
|
task_data="$(task $id)"
|
||||||
|
@ -17,4 +16,7 @@ del_ids=$(for id in $excluded_ids $ids
|
||||||
echo $id
|
echo $id
|
||||||
done | sort | uniq -u)
|
done | sort | uniq -u)
|
||||||
|
|
||||||
task $del_ids del
|
if [ ! -z "$del_ids" -a "$del_ids" != " " ]
|
||||||
|
then
|
||||||
|
task $del_ids del
|
||||||
|
fi
|
||||||
|
|
Loading…
Reference in a new issue