Mike Frysinger <vapier@xxxxxxxxxx> writes: >> So, overall, why not make generate_email_header() be simply: >> >> generate_email_header() >> { >> # --- Email (all stdout will be the email) >> # Generate header >> subst_vars <<-EOF >> To: $recipients >> Subject: ${emailprefix}${emailsubject} >> X-Git-Refname: @refname@ >> X-Git-Reftype: @refname_type@ >> X-Git-Oldrev: @oldrev@ >> X-Git-Newrev: @newrev@ >> >> ${emailbodyintro} >> >> EOF >> } >> >> This would also let you simply subst_vars() so that it needn't support >> piped invocations, no? (Not a very drastic simplification, but still...) > > if emailbodyintro is empty, this adds two useless newlines. otherwise, this > would be fine i think. I haven't looked at the original that is being improved upon (because I am not very interested in this sample script myself), but I have two comments on the above. - You can do something like this to fix that "empty line" issue, no? LF=' ' ;# newline subst_vars <<-EOF ... ${emailbodyintro:+"$emailbodyinto$LF"} EOF - If you are using shell variable interpolation anyway, why do you still need @special_name@ interpolated with perl or sed or whatever you are using in subst_vars (which I didn't look at)? If you have $refname, $refname_type and friends, can't the above become "cat <<-EOF"? -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html