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.
This commit is contained in:
8
todo.sh
8
todo.sh
@@ -1,7 +1,7 @@
|
|||||||
#! /bin/bash
|
#! /bin/bash
|
||||||
|
|
||||||
# === HEAVY LIFTING ===
|
# === HEAVY LIFTING ===
|
||||||
shopt -s extglob
|
shopt -s extglob extquote
|
||||||
|
|
||||||
# NOTE: Todo.sh requires the .todo/config configuration file to run.
|
# 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.
|
# Place the .todo/config file in your home directory or use the -d option for a custom location.
|
||||||
@@ -267,9 +267,9 @@ cleanup()
|
|||||||
|
|
||||||
cleaninput()
|
cleaninput()
|
||||||
{
|
{
|
||||||
# Cleanup the input
|
# Replace CR and LF with space; tasks always comprise a single line.
|
||||||
# Replace newlines with spaces Always
|
input=${input//$'\r'/ }
|
||||||
input=`printf %s "$input" | tr '\r\n' ' '`
|
input=${input//$'\n'/ }
|
||||||
|
|
||||||
if [ "$1" = "for sed" ]; then
|
if [ "$1" = "for sed" ]; then
|
||||||
# This action uses sed with "|" as the substitution separator, and & as
|
# This action uses sed with "|" as the substitution separator, and & as
|
||||||
|
|||||||
Reference in New Issue
Block a user