From ef9c48d7efe8dcb4267dfd7d637e3fbe1bd0b7f4 Mon Sep 17 00:00:00 2001 From: Ingo Karkat Date: Tue, 31 May 2011 17:03:30 +0200 Subject: [PATCH] Perform cleaninput() filtering without tr. Again, Bash's global pattern substitution can be used. This only depends on the "extquote" shell option, which is set by default, but we set this just to be sure. --- todo.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/todo.sh b/todo.sh index 1840cd3..aa9ca38 100755 --- a/todo.sh +++ b/todo.sh @@ -1,7 +1,7 @@ #! /bin/bash # === HEAVY LIFTING === -shopt -s extglob +shopt -s extglob extquote # NOTE: Todo.sh requires the .todo/config configuration file to run. # Place the .todo/config file in your home directory or use the -d option for a custom location. @@ -267,9 +267,9 @@ cleanup() cleaninput() { - # Cleanup the input - # Replace newlines with spaces Always - input=`printf %s "$input" | tr '\r\n' ' '` + # Replace CR and LF with space; tasks always comprise a single line. + input=${input//$'\r'/ } + input=${input//$'\n'/ } if [ "$1" = "for sed" ]; then # This action uses sed with "|" as the substitution separator, and & as