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" <