Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

set -x for embedded script

21 views
Skip to first unread message

James

unread,
Oct 13, 2016, 1:57:15 PM10/13/16
to
If a script runs another script, how do I "set -x" mode for the embedded bash script?

$ cat t.sh
t2.sh

$ bash -x t.sh

TIA
James

Kerin Millar

unread,
Oct 13, 2016, 2:52:06 PM10/13/16
to
Given the use of bash, you could render SHELLOPTS exportable:-

$ ( export SHELLOPTS; bash -x t.sh )

Alternatively, you could source t2.sh so that its commands are executed in the same shell.

--
kfm

James

unread,
Oct 13, 2016, 8:16:42 PM10/13/16
to
On Thursday, October 13, 2016 at 11:52:06 AM UTC-7, Kerin Millar wrote:

> Given the use of bash, you could render SHELLOPTS exportable:-
>
> $ ( export SHELLOPTS; bash -x t.sh )
>
> Alternatively, you could source t2.sh so that its commands are executed in the same shell.
>
> --
> kfm

Thanks, exporting SHELLOPTS does the job.

James
0 new messages