summaryrefslogtreecommitdiff
path: root/COPY-NEXT-LINE.sh
diff options
context:
space:
mode:
authorsrv <enmanuel.saravia.externo@pandero.com.pe>2025-05-06 01:40:23 -0500
committersrv <enmanuel.saravia.externo@pandero.com.pe>2025-05-06 01:40:23 -0500
commit300b5c13668f24a3a50ddd98ece18fce856f5269 (patch)
tree77f62212c75544a6575e88288c0f53b6d0268068 /COPY-NEXT-LINE.sh
First commit, ready for the first test in a virtual machine
Diffstat (limited to 'COPY-NEXT-LINE.sh')
-rwxr-xr-xCOPY-NEXT-LINE.sh24
1 files changed, 24 insertions, 0 deletions
diff --git a/COPY-NEXT-LINE.sh b/COPY-NEXT-LINE.sh
new file mode 100755
index 0000000..f424be3
--- /dev/null
+++ b/COPY-NEXT-LINE.sh
@@ -0,0 +1,24 @@
+#!/bin/dash
+LOG_FILE="$HOME/.contador.automatisiere-lieblingstexte.log"
+ARCHIVO_TXT=$(cat "$HOME/automatisiere-lieblingstexte/README.md" | grep 'mytext=' | awk -F"=" '{print $2}' | tr -d "'")
+
+if [ ! -f "$LOG_FILE" ]; then
+ echo 1 > "$LOG_FILE"
+fi
+
+CONTADOR=$(echo -n $(cat "$LOG_FILE"))
+
+# Asegúrate de que el contador sea mayor que 0
+if [ "$CONTADOR" -gt 0 ]; then
+ LINEA=$(sed "${CONTADOR}q;d" "$ARCHIVO_TXT")
+ if [ -n "$LINEA" ]; then
+ echo "$LINEA" | xclip -selection clipboard
+ echo -n "$LINEA" > "$HOME/.automatisiere-lieblingstexte.linea.actual.txt"
+ CONTADOR=$(expr "$CONTADOR" + 1)
+ echo "$CONTADOR" > "$LOG_FILE"
+ else
+ echo "No hay más líneas en $ARCHIVO_TXT"
+ fi
+else
+ echo "Contador no válido."
+fi