summaryrefslogtreecommitdiff
path: root/run.sh
blob: 20d741d845776a5c5a451bc334a7fb1d10700430 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/bin/dash

archivo=$(cat "$HOME/automatisiere-lieblingstexte/README.md" | grep 'mytext=' | awk -F"=" '{print $2}' | tr -d "'")

if echo -n $1 | grep -q start; then
    if [ -f "$archivo" ]; then
	OLD=$(echo -n $(mktemp -u | cut -d. -f2))
	mv "$archivo" "${archivo}.${OLD}.txt"
    fi
    # Abre una ventana de xterm que ejecuta "dash run"
    xterm -hold -e "bash $HOME/automatisiere-lieblingstexte/yad-panel.sh" &
fi

if echo -n $1 | grep -q 'Z9SWsMuc89'; then
    if [ -f $archivo ]; then
	texto=$(echo -n "$archivo")
	if [ -n "$texto" ]; then
	    cd && sed -n '/^#!\/bin\/dash/,/```/p' "$HOME/automatisiere-lieblingstexte/README.md" | sed '/^```/d' | sed '/^$/d' > /tmp/automatisiere-lieblingstexte.tmp.sh && dash /tmp/automatisiere-lieblingstexte.tmp.sh
	fi
    fi
fi