lb

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit a91ffe925d604732ebeb81b6c1e6aafed8c4f46e
parent 21cbc410afe2dc6bc2a09d4e2b8b6bc37fa603c3
Author: Luke Smith <luke@lukesmith.xyz>
Date:   Mon,  3 Sep 2018 12:57:04 -0400

duplicate entry name handling

Diffstat:
Mlb | 5++++-
1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/lb b/lb @@ -32,7 +32,10 @@ listandReturn() { \ getTitle() { \ echo "Post will be stored as draft in $draftdir until finalized." read -rp "Give a title for your post: " title - url=$(echo $title | sed -e "s/'\|\"\|=\|+\|_\|,\|\.\|:\|;\|?\|!\|@\|\*\|&\|(\|)\|[\|]\|<\|>//g;s/ /-/g" | tr '[:upper:]' '[:lower:]') ;} + url=$(echo $title | sed -e "s/'\|\"\|=\|+\|_\|,\|\.\|:\|;\|?\|!\|@\|\*\|&\|(\|)\|[\|]\|<\|>//g;s/ /-/g" | tr '[:upper:]' '[:lower:]') + grep "$url" "$blogfile" &>/dev/null && lbdupnum=1 && while [ grep "$url" "$blogfile" ]; do lbdupnum=$((lbdupnum+1)); done + [ ! -z ${lbdupnum+x} ] && url="$url"-"$lbdupnum" + } postNew() { \ mkdir -p "$draftdir"