mybin

my ~/bin
git clone https://a3nm.net/git/mybin/
Log | Files | Refs | README

commit 435db85f1c3fcc483827b837110d52406127bb97
parent e21b32c7a04403932b88896b22775d0fbdfd71ac
Author: Antoine Amarilli <a3nm@a3nm.net>
Date:   Sat, 23 Dec 2023 22:46:08 +0100

wiki

Diffstat:
wikifolder | 17+++++++++++++++++
wikiok | 21+++++++++++++++++++++
2 files changed, 38 insertions(+), 0 deletions(-)

diff --git a/wikifolder b/wikifolder @@ -0,0 +1,17 @@ +#!/bin/bash + +FILE="$1" +FOLDER="$2" +cd "$HOME/todo/wiki" + +if grep '^Folder: ' $FILE > /dev/null +then + sed -i "s/^Folder: .*/Folder: $FOLDER/" $FILE +else + # Remove blank lines from the end of a file: + # https://unix.stackexchange.com/a/552195 + sed -i -e :a -e '/^\n*$/{$d;N;ba' -e '}' $FILE + echo >> $FILE + echo "Folder: $FOLDER" >> $FILE +fi + diff --git a/wikiok b/wikiok @@ -0,0 +1,21 @@ +#!/bin/bash + +FILE="$1" +cd "$HOME/todo/wiki" + +if grep '^OK: ' $FILE > /dev/null +then + if grep '^OK: yes$' $FILE > /dev/null + then + sed -i 's/^OK: yes$/OK: no/' $FILE + else + sed -i 's/^OK: .*/OK: yes/' $FILE + fi +else + # Remove blank lines from the end of a file: + # https://unix.stackexchange.com/a/552195 + sed -i -e :a -e '/^\n*$/{$d;N;ba' -e '}' $FILE + echo >> $FILE + echo "OK: yes" >> $FILE +fi +