On Thu, Feb 08, 2024 at 05:48:18PM +0200, Timotei Campian wrote: > 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 > > $
It looks like your session used a different definition of printargs, which has printf "%sx" instead of printf "%s|". Here's what I get with the correct function: unicorn:~$ bash-5.2 unicorn:~$ printargs() { printf "%s|" "$@"; echo; } unicorn:~$ set -x unicorn:~$ printargs + printargs + printf '%s|' |+ echo unicorn:~$ This one has the pipeline where yours has the x, in both places.