On Mon, Aug 15, 2011 at 03:33:28PM +0200, Lukas Fleischer wrote:
On Mon, Aug 15, 2011 at 03:27:27PM +0200, Lukas Fleischer wrote:
On Mon, Aug 15, 2011 at 03:12:45PM +0200, Pierre Schmitz wrote:
On Mon, 15 Aug 2011 09:47:16 +0200, Lukas Fleischer wrote:
Commit c51cc8d365fad3be529776e9dce34ac115664451 erroneously introduced a tab character that is prepended to the body of each commit message. Fix this by using C-style newline escape sequences which will avoid further whitespace issues caused by re-indentation of code at this point.
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de> --- commitpkg | 4 +--- 1 files changed, 1 insertions(+), 3 deletions(-)
diff --git a/commitpkg b/commitpkg index 4d5054b..bdc1fd6 100755 --- a/commitpkg +++ b/commitpkg @@ -110,9 +110,7 @@ fi
if [ -n "$(svn status -q)" ]; then echo -n 'committing changes to trunk...' - msgtemplate="upgpkg: $pkgbase $(get_full_version ${epoch:-0} $pkgver $pkgrel) - - " + msgtemplate="upgpkg: $pkgbase $(get_full_version ${epoch:-0} $pkgver $pkgrel)"$'\n\n' if [ -n "$1" ]; then svn commit -q -m "${msgtemplate}${1}" || abort else
Good catch. But does this work for you? E.g. the following coe wont work for me:
Yes, I tested the patch.
test="foo"$'\n\n' echo $test
bash's echo builtin splits arguments by spaces and it does parse each line as separate argument if you don't use quotes here. `echo "$test"` should work fine.
Sorry, bad wording here. What I wanted to say is that bash's echo builtin prints arguments separated by spaces. Quoting bash(1):
Output the args, separated by spaces, followed by a newline.
Just use proper quoting (which we already do in commitpkg though, I just double-checked).
But this does work:
echo "foo"$'\n\n'
Yes this is why quoting is so important in shell. It's as much syntax as anything else in the grammar. Alternatively, printf makes this a lot clearer (imo), but of course will not absolve you from quoting on expansion: printf -v msgtemplate 'upgpkg: %s %s\n\n' \ "$pkgbase" \ "$(get_full_version ${epoch:-0} "$pkgver" "$pkgrel")" Really, echo should just be avoided whenever possible. It's behavior is inconsistant. POSIX actually discourages new scripts to use echo and prefers printf instead. $ echo "-n" $ echo -- "-n" -- -n printf is always reliable here: $ printf -- '-v\n' -v d