diff options
-rwxr-xr-x | collector | 9 |
1 files changed, 7 insertions, 2 deletions
@@ -9,6 +9,7 @@ # Parameters BASENAME="`basename $0`" ACTION="$1" +COLLECTOR_NAME="`echo $COLLECTOR_FILE | sed -e "s|$HOME|~|"`" # Check if [ -z "$COLLECTOR_FILE" ]; then @@ -30,13 +31,17 @@ elif [ "$ACTION" == "add" ]; then echo "* $*" >> "$COLLECTOR_FILE" elif [ "$ACTION" == "list" ]; then if grep -q -e "^ *\* " "$COLLECTOR_FILE"; then - COLLECTOR_NAME="`echo $COLLECTOR_FILE | sed -e "s|$HOME|~|"`" - echo "Collected items at $COLLECTOR_NAME:" echo "" grep -e "^ *\* " "$COLLECTOR_FILE" echo "" fi +elif [ "$ACTION" == "count" ]; then + if grep -q -e "^ *\* " "$COLLECTOR_FILE"; then + COUNT="`grep -e "^ *\* " "$COLLECTOR_FILE" | wc -l`" + echo "$COUNT collected items at $COLLECTOR_NAME" + echo "" + fi elif [ "$ACTION" == "edit" ]; then if [ ! -z "$EDITOR" ]; then $EDITOR "$COLLECTOR_FILE" |