Skip to content

Instantly share code, notes, and snippets.

@petrohs
Created August 20, 2020 06:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save petrohs/f21ca7f41ad7e7f401c6050247c2655b to your computer and use it in GitHub Desktop.
Save petrohs/f21ca7f41ad7e7f401c6050247c2655b to your computer and use it in GitHub Desktop.
zimScripts_pcal¦ Script para zim generando pcal
#!/bin/bash
BASE=/home/petrohs/Notebooks/Notes/Journal
cad=`zenity \
--title="pCal" \
--forms \
--add-entry=Año \
--add-entry=Mes \
--text="Mes a generar"`
ANNO=`echo $cad | cut -d\| -f1`
MES=`echo $cad | cut -d\| -f2-`
>/tmp/tmp_${ANNO}${MES}.pcal
>/tmp/tmp_${ANNO}${MES}.pdf
for dd in `ls -1 $BASE/$ANNO/$MES/`
do
d=`echo "$dd" | sed -e "s/.txt//" -e "s/^0//"`
egrep "* {T}|[ ] {T}|[x] {T}|[*] {T}" $BASE/$ANNO/$MES/$dd | sed -e "s/{T}//" -e "s/ /./g" -e "s/.*/$MES|$d|$ANNO &/" >>/tmp/tmp_${ANNO}${MES}.pcal
done
pcal -a es -F 1 -f /tmp/tmp_${ANNO}${MES}.pcal $MES $ANNO | ps2pdf - /tmp/tmp_${ANNO}${MES}.pdf
evince /tmp/tmp_${ANNO}${MES}.pdf &
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment