Você pode ativar / desativar esse recurso usando o comando set
e a opção -x/+x
.
-x - After expanding each simple command, for command, case command, select command, or arithmetic for command, display the expanded value of PS4, followed by the command and its expanded arguments or associated word list.
-x
ativa, +x
desativa.
Exemplo
script de amostra$ cat ~/myscript.sh
#!/bin/bash
set -x
echo "Hello"
exemplo de saída
$ ~/myscript.sh
+ echo Hello
Hello