maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Android (https://talk.maemo.org/forumdisplay.php?f=54)
-   -   [SCRIPT] keacx.sh - a simple CLI diary entry for termux (https://talk.maemo.org/showthread.php?t=100075)

maegon9y00 2017-11-28 13:53

[SCRIPT] keacx.sh - a simple CLI diary entry for termux
 
Well it's not a big deal. I was playing with termux and its capabilities so i wrote this simple script.
What it does?
- add a note with the actual time to a file of the actual day.
- Show the entries you made on the actual day

It creates a folder on $HOME/7102kdat and stores your data
Uses a file in the format kYYYYMMDD.dat. 1 file for day with notes.

It should work on n900, n9, and busybox, perhaps with any/no modification

Code:

#!/bin/bash
# keacx.sh simple diary entry for termux
# by maegon9y00
# 28nov 2017
# Commands used: date, if then echo read clear less exit
# variables used: $ARC $CAR $# $KEHAGO $HOR 
# Usage: . keacx.sh your_anotations
# Usage: . keacz.sh [Enter]

ARC=k$(date +%Y%m%d).dat #nombre del archivo de datos
CAR=$HOME/7102kdat #path de datos

if [[ ! -d $CAR ]]; then mkdir $CAR; fi #make folder 1st time
if [ $# -eq 0 ]  # $# te dice cuantos argumentos pasaron al script, si son 0 entonces te pregunta
  then
        echo -e '\033[32m Que haces? \033[0m' # pregunta en color verde(32) y luego al blanco habitual (0)
        read -e KEHAGO
        HOR=$(date +%H:%M:%S)
        echo $HOR $KEHAGO
        clear
        echo $HOR $KEHAGO>>$CAR/$ARC
        echo -e '\033[34m'  # cambia a color azul
        less $CAR/$ARC
        exit 1 # da por terminada la condición y finaliza el script si se cumple la condición
 fi


# Si me escribió un argumento, lo agrega sin preguntarme.
HOR=$(date +%H:%M:%S)
        echo $HOR $*
        clear
        echo $HOR $*>>$CAR/$ARC
        echo -e '\033[33m'  # cambia a color amarillo
        less $CAR/$ARC


pichlo 2017-11-28 15:11

Re: [SCRIPT] keacx.sh - a simple CLI dairy entry for termux
 
Sorry, I do not have anything useful to contribute, all I have to say is,

"Dairy"? Blessed are the cheese makers? ;)

maegon9y00 2017-11-28 17:30

Re: [SCRIPT] keacx.sh - a simple CLI dairy entry for termux
 
Quote:

Originally Posted by pichlo (Post 1538866)
Sorry, I do not have anything useful to contribute, all I have to say is,

"Dairy"? Blessed are the cheese makers? ;)

Thanks pichlo for let me know this mistake:D.
I corrected the "dairy" thing.


All times are GMT. The time now is 13:49.

vBulletin® Version 3.8.8