-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtodo.sh
More file actions
executable file
·47 lines (39 loc) · 822 Bytes
/
todo.sh
File metadata and controls
executable file
·47 lines (39 loc) · 822 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/bin/bash
# Updated target to DropBox so db can comes across machines
TARGET=~/Desktop/Dropbox/.todo
if [ -d $1 ] && [ $# -gt 0 ]
then
TARGET=$1/.todo
shift
fi
touch $TARGET
if [ $# -eq 0 ]
then
echo ; nl $TARGET ; echo
fi
if [ "$1" = "add" ]
then
shift
echo "$*" >> $TARGET
echo ; nl $TARGET ; echo
fi
if [ "$1" = "remove" ] || [ "$1" = "done" ]
then
sed -i.bak -e "$2d" $TARGET
rm $TARGET.bak
echo ; nl $TARGET ; echo
fi
if [ "$1" = "clear" ]
then
echo "" > $TARGET
sed -i.bak -e "1d" $TARGET
rm $TARGET.bak
echo ; nl $TARGET ; echo
fi
if [ "$1" = "search" ]
then
grep -IFnr --directories=recurse "TODO" * | grep -v "todo.sh"| uniq >> $TARGET
cat $TARGET | sort -u > $TARGET.bak
mv $TARGET.bak $TARGET
echo ; nl $TARGET ; echo
fi