~ $ args1() { printf %s\ "${@@K}" ; printf \\n ; } ; args1 echo foo ; args1 echo two three 'echo' 'foo' 'echo' 'two' 'three' ~ $
On Wed, Jun 12, 2024, 10:52 PM alex xmb sw ratchev <fxmb...@gmail.com> wrote: > ~ $ logf=$HOME/alog1 ; run1() { printf '%(%F+%T%z)T %s' -1 "$1" >>"$logf" > ; (( $# > 1 )) && printf \ %s "${@:2}" >>"$logf" ; "$@" ; >>"$logf" printf > \\n ; } ; run1 echo foo ; cat "$logf" > foo > 2024-06-12+22:51:31+0200 echo foo > ~ $ > > On Wed, Jun 12, 2024, 10:26 PM Greg Wooledge <g...@wooledge.org> wrote: > >> On Wed, Jun 12, 2024 at 07:31:13PM +0200, Angelo Borsotti wrote: >> > "set -x" makes the ensuing commands be printed, but prefixed >> > with "+ ", which makes the result look ugly, not to mention that >> > the following "set +x" is echoed too (there are hacks to suppress >> > the "set +x" output, but they are just hacks). >> >> If all you want is to remove the "+ ", you can simply set the PS4 >> variable to an empty string. >> >> > set -o log >> > cat tmp >tmp1 # or any other command >> > set -o nolog >> > >> > producing the output on the console >> > >> > cat tmp >tmp1 >> >> If you want to retain redirections in the -x output, that's a whole >> different issue. There is currently no way to do that. Chet would >> have to implement something. >> >>