tMake post.sh more robust against POSIX - monochromatic - monochromatic blog: http://blog.z3bra.org
(HTM) git clone git://z3bra.org/monochromatic
(DIR) Log
(DIR) Files
(DIR) Refs
---
(DIR) commit f4e94709b37a9edfb1d118a8f916fd4794a46c2f
(DIR) parent 76dad7929494c281aba0eef7d50b84f5beffae00
(HTM) Author: z3bra <willyatmailoodotorg>
Date: Mon, 21 Dec 2015 13:06:27 +0000
Make post.sh more robust against POSIX
Diffstat:
M post.sh | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
---
(DIR) diff --git a/post.sh b/post.sh
t@@ -1,10 +1,10 @@
-#!/bin/bash
+#!/bin/sh
# Ask the user for a title
read -p "Post title: " title
# use post title to name the file
-file=`echo ${title}| tr -d ",.?!;\"'" | sed "s/\s\+$//;s/\s\+/-/g;s/./\L&/g"`.txt
+file=`echo ${title}| tr -d ",.?!;\"'" | tr -s ' ' | tr 'A-Z ' 'a-z-' | sed "s/-*$//"`.txt
test -z "$file" && exit 1