Sample Header Ad - 728x90

set -o xtrace for just one line?

2 votes
2 answers
347 views
bash 4.4.20(1) on RHEL 8.4. set -x ; ./blarge ; set +x *works*, of course, but it's just that much more *stuff* to remember to remove when you're finished. And gets sticky if you're running ssh, sudo, etc. Thus, as mentioned in the Subject, is there some way to tell set -x to work just on one line, as FOO=bar ./blarge sets the FOO variable to barge just for that one execution of blarge? declare Srv=s1.example.com declare DB=a_db declare Tables="-t table1 -t table2" date +"%F %T, %a Starting" set -x vacuumdb --host=$Srv -j2 --dbname=$DB $Tables --analyze set +x date +"%F %T, %a Finished"
Asked by RonJohn (1421 rep)
Jun 12, 2024, 02:58 PM
Last activity: Jun 12, 2024, 07:15 PM