1

一部の機能のデバッグを支援するために、bash スクリプト内で「set -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.

ただし、機能を終了する前にクリアできるようにしたい

例えば:

    #/bin bash

    function somefunction() 
    {
        set -x

        # some code I'm debugging

        # clear the set -x
        set ????
    }

    somefunction 
4

3 に答える 3

5

マニュアルの引用:

- ではなく + を使用すると、これらのフラグがオフになります。

だから、それset +xはあなたが探しているものです。

于 2013-10-01T20:01:30.833 に答える