From: Stephen Rothwell Date: Thu, 1 Oct 2020 01:10:34 +0000 (+1000) Subject: message_helper: improve filtering X-Git-Url: https://git.ozlabs.org/?a=commitdiff_plain;h=ab5821e1a079eb93a428b4116cef4b27d26cbc72;p=next-scripts message_helper: improve filtering --- diff --git a/message_helper b/message_helper index 517fbe9..09985af 100755 --- a/message_helper +++ b/message_helper @@ -30,13 +30,14 @@ fi contact=$(get_contacts "$branch") subject=${1//BRANCH/$branch} -filter="sed -e 's/BRANCH/$branch/g'" -if [ "$kconfig" ]; then - filter="$filter -e 's/KCONFIG_NAME/$kconfig/g'" +filter=( -e "s/BRANCH/$branch/g" ) +if [ -n "$kconfig" ]; then + filter+=( -e "s/KCONFIG_NAME/$kconfig/g" ) fi -filter="$filter | fmt -s" -{ printf 'Hi all,\n\n'; eval "$filter"; } | - "$bin_dir"/send_email "linux-next: $subject" "$contact" "${cc[@]}" +{ + printf 'Hi all,\n\n' + sed "${filter[@]}" | fmt -s +} | "$bin_dir"/send_email "linux-next: $subject" "$contact" "${cc[@]}" exit 0