bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

printf - strange behaviour in debug mode (BASH_VERSION="5.2.21(1)-releas


From: Timotei Campian
Subject: printf - strange behaviour in debug mode (BASH_VERSION="5.2.21(1)-release")
Date: Thu, 8 Feb 2024 17:48:18 +0200

Dear DEV TEAM,

I want to report a strange *printf* behaviour which appears in debug mode +
no arguments.

OS: Debian GNU/Linux 12 (bookworm)
BASH_VERSION="5.2.15(1)-release"

OS: MACOS
BASH_VERSION="5.2.21(1)-release"

The culprit function is *printargs() { printf "%s|" "$@"; echo; }*

calling it with no arguments it prints as expected the pipe: "|"
while in debug mode (set -x), only a *blank line* is printed:

$ printargs
printargs
+ printargs
+ printf %sx
x+ echo

$

I noticed that the expected pipe is printed in case of:

   1. adding a new line after the pipe
   printargs() { printf "%s|*\n*" "$@"; echo; }
   2. suppressing STDERR
   printargs *2>/dev/null*

Could you check it out too, please?
With much consideration and gratitude - thank you!


reply via email to

[Prev in Thread] Current Thread [Next in Thread]