How to debug and trace into several bash files
Hi,
First thank you for your awesome plugin 👋
I would like to know if it is possible to debug in several files.
For instance, I manage perfectly to debug a sh file but at some I would like to step in (F11) another sh file. I have a sh file that is calling another one. But the later, it seems I cannot trace into it.
I do not know if it is even possible as I even tried to call the secondary script with its full path and put breakpoints there, without success. If yes, could you please tell me how please ?
Thank you
It is possible, when you use bash "source" keyword, or simply "."
https://superuser.com/questions/46139/what-does-source-do
This solution enables to step in other scripts, thanks.
However it changes the behavior. For instance, let's say that I set a variable at the beginning of each script like:
SCRIPT_NAME=$(basename $0)
all my sourced scripts would have the value of the main script calling them instead of their own value.
Is there a workaround to this ?
There is no workaround, since separate bash process is created when you execute script instead of calling it via source.