scripts

various script and utils
git clone git://z3bra.org/scripts
Log | Files | Refs

commit a322bc717e3166be6c0a9ac4fa6037bdd8a0fc9b
parent 838a79c6561ff117e4a04df0fa08a1a689a034ca
Author: z3bra <willy@mailoo.org>
Date:   Thu Oct 23 15:37:36 +0200

Simple way to delete a line

Diffstat:
todo | 8++++++++
1 file changed, 8 insertions(+), 0 deletions(-)
diff --git a/todo b/todo @@ -26,6 +26,14 @@ append() { echo "$*" >> $TODO } +delete() { + test -n "$1" || exit 1 + sed -i "${1}d" $TODO +} + +# delete line "$2" (see delete() function) +test "$1" = '-d' && delete "$2" && exit 0 + # append arguments to the file, or print it otherwise test -n "$*" && append $* || list