tpost.sh: allow title passed as argument - monochromatic - monochromatic blog: http://blog.z3bra.org
HTML git clone git://z3bra.org/monochromatic
DIR Log
DIR Files
DIR Refs
---
DIR commit c324148a7e8621ec00c94808b1e52ff8fd0f2f1b
DIR parent ea5d78639c0ec73e577163083b8e0502c85e198e
HTML Author: z3bra <willyatmailoodotorg>
Date: Tue, 30 Aug 2016 14:13:41 +0200
post.sh: allow title passed as argument
Diffstat:
M post.sh | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
---
DIR diff --git a/post.sh b/post.sh
t@@ -1,7 +1,12 @@
#!/bin/sh
# Ask the user for a title
-read -p "Post title: " title
+if [ $# -lt 1 ]; then
+ printf "Post title: "
+ read title
+else
+ title="$@"
+fi
# use post title to name the file
file=`echo ${title}| tr -d ",.?!;\"'" | tr -s ' ' | tr 'A-Z ' 'a-z-' | sed "s/-*$//"`.txt
t@@ -25,7 +30,6 @@ cat <<EOF > ${post}
# [${title}](#)
## — ${date}
-<!-- vim: set ft=markdown ts=4 et tw=80: -->
EOF
if ! test -f ${post}; then