commit aadef4753aaf342c78a05498b7bc5306b0f6e0ed parent 5092579b74ae8ae2ce9df309e391f42b95442465 Author: Jeff <dev@watertao.xyz> Date: Fri, 4 Apr 2025 15:14:23 -0700 Better empty db file checks and updated README Diffstat:
M | README | | | 10 | ++++++++-- |
M | mpdhh.sh | | | 9 | +++++---- |
2 files changed, 13 insertions(+), 6 deletions(-)
diff --git a/README b/README @@ -40,8 +40,14 @@ hugo or full html markup needed Notes ----- -note: watertao.xyz is hugo project bin. Doesn't have to be hugo. -Can be whatever. +note: example.com is a hugo project dir. Doesn't have to be hugo. +Can be whatever. mpdhh looks for and runs a 'publish.sh' file in the +project dir. It is in this file you run all your cms commands to +update your website. A simple one-liner gets it done for a git +managed hugo setup: + +hugo && git add . && git commit && git push + This program assumes the following tree: (run mpdhh.sh 4 to create the tree) diff --git a/mpdhh.sh b/mpdhh.sh @@ -114,11 +114,12 @@ update_db_index_file(){ # Sed will not inject anything before line 1 # if there is no line 1 (empty/new file) # so in this case just throw the line in there - if [ ! -f "$db_index_file" ]; then + if [ ! -f "$db_index_file" ] + then printf "%s\n" "$1" > "$db_index_file" - elif [ "$(<"$db_index_file" wc -l)" -gt 0 ]; then - + elif [ -s "$db_index_file" ] + then ! grep "$1" "$db_index_file" && \ sed -i '1i '"$1"' ' "$db_index_file" @@ -221,7 +222,7 @@ update_csv(){ # - insert new track # else if track data empty # - do nothing but return 1 - elif [ "$(<"$pl_file" wc -l)" -gt 0 ]; then + elif [ -s "$pl_file" ]; then [ -z "$track_data" ] && return 1