Various Linux scripts.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

24 lines
802 B

12 years ago
#!/bin/bash
#- Заметки
memfile=$SHELLRC/var/memory/mem
case "$1" in
-h) printf "\tКлючи:\n\
-e\t-Редактирование записей\n\
-l n\t-Последние n записей\n\
-s\t-Поиск по записям\n\
-remove\t-Удалить запись по номеру\n\
-clear\t-Удалить все записи\n\
-h\t-Справка\n";;
-e) vim $memfile;;
-l) tail -"$2" $memfile | nl | \grep --color -E '.{1,}==>';;
-s) grep "$2" $memfile | nl | \grep --color -E '.{1,}==>';;
-remove) sed "$2d" -i $memfile;;
-clear) > $memfile;;
'') cat $memfile | nl | \grep --color -E '.{1,}==>';;
*) printf "[ `\date '+%d.%m.%Y %H:%M:%S'` ] ==> $*\n" >> $memfile && printf \
"$greenЗаметка$yellow $* $greenуспешно добавлена\n$rstc"
12 years ago
esac