In bash, quando si esegue con l' -xopzione, è possibile esentare i singoli comandi dall'eco?
Sto cercando di rendere l'output il più pulito possibile, quindi sto eseguendo alcune parti del mio script in una subshell con set +x. Tuttavia, la riga set +xstessa viene ancora ripetuta e non aggiunge informazioni preziose all'output.
Ricordo che ai vecchi .battempi, quando correvo echo on, le singole linee potevano essere esentate avviandole con un @. C'è qualche equivalente in bash?
#!/bin/bash -x
function i_know_what_this_does() {
(
set +x
echo do stuff
)
}
echo the next-next line still echoes 'set +x', is that avoidable?
i_know_what_this_does
echo and we are back and echoing is back on
Quando si esegue quanto sopra, l'output è:
+ echo the next-next line still echoes 'set +x,' is that 'avoidable?'
the next-next line still echoes set +x, is that avoidable?
+ i_know_what_this_does
+ set +x
do stuff
+ echo and we are back and echoing is back on
and we are back and echoing is back on