>From: Greg Wooledge <greg@wooledge.org>
>To: help-bash@gnu.org
>Subject: Re: \n displayed instead of newline
>Date: 29/06/2021 20:26:52 Europe/Paris
>On Tue, Jun 29, 2021 at 07:50:05PM +0200, lisa-asket@perso.be wrote:
>> Why does the first `\n` display as a string rather than a newline in the
>> following printf? Â
>>
>>
>>
>> printf "Usage: $ua\n      $ub\n"
>It doesn't.
>However, you've got a problem (bug) here: you're passing arbitrary
>expanded variables to printf as part of its format argument. If one or
>both of those variables contain syntax that printf uses for formatting,
>you'll get undesired results.
Understood. Thanks
>The correct way to write this would be:
>printf 'Usage: %s\n      %s\n' "$ua" "$ub"
This is what I have
   ua="grep -ir --exclude=\\*.el --include=\\*.{org,texi} \\"
   ub=" -C 8 \"hilbert\" /marshall/"
   printf "Usage: %s\n %s\n" $ua $ub
>It's possible that whatever symptom you're seeing is the result of
>there being backslashes or other special characters in the ua variable.
>Therefore, for debugging purposes, your first instinct should be to
>dump the contents of the ua and ub variables at the time this printf
>command runs. You can do this with "set -x", or by explicitly running
>"declare -p ua ub", or several other possible ways.
Yes, I got backslashes in the `ua` and `ub` variables.