From 74ffbc116b207be90e11fbdbbd282415a2f51165 Mon Sep 17 00:00:00 2001 From: Eduard Tolosa Date: Wed, 12 Feb 2025 03:53:42 +0000 Subject: [PATCH] Script to create new posts on jekyll --- user-bin/newpost | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 user-bin/newpost diff --git a/user-bin/newpost b/user-bin/newpost new file mode 100644 index 0000000..ecfdff0 --- /dev/null +++ b/user-bin/newpost @@ -0,0 +1,29 @@ +#!/bin/bash +if [ $# -gt 0 ]; then + filename=_posts/$(date +%Y-%m-%d-) + # Replace all the special characters with a hyphen + filename+=${*//[^a-zA-Z0-9_]/-}.md + filename=$(echo "$filename" | tr '[:upper:]' '[:lower:]' | sed 's/-\{2,\}/-/g') + if [ ! -f "$filename" ]; then + cat >"$filename" <