vscode-bash-debug icon indicating copy to clipboard operation
vscode-bash-debug copied to clipboard

$0 is set to bashdb - what about using "bash --debugger"?

Open mlocati opened this issue 6 years ago • 7 comments

When debugging bash scripts, we currently have that $0 evaluates to usr/bin/bashdb.

In order to solve this, what about using the --debugger option of bash? See the Description section of http://bashdb.sourceforge.net/bashdb-man.html

mlocati avatar Mar 13 '18 14:03 mlocati

About the --debugger option - this is something for next release.

Currently we run bashdb with: bashdb --quiet --tty ./fifo_file_path -- script.sh arg1 arg2

just wondering how to pass those bashdb params with this: bash --debugger [bash-options...] script-name [[--] script options]

rogalmic avatar Mar 13 '18 15:03 rogalmic

Great to hear! Which version of bashdb does support it?

It seems to be there since 2006-01-29 (see https://sourceforge.net/p/bashdb/code/ci/master/tree/ChangeLog )

About the --debugger option - this is something for next release.

Great! Looking forward to it. PS: you can read more here: http://bashdb.sourceforge.net/bashdb.html#Having-bash-invoke-the-debugger-and-your-shell-script

mlocati avatar Mar 13 '18 15:03 mlocati

I am getting the following message within the "DEBUG CONSOLE" tab when I debug my script: "tput: No value for $TERM and no -T specified"

I use T_COLS=tput cols so I can determine the number of columns for proper formatting.

Is there something I didn't set correctly. I checked and confirmed the environmental variable TERM is set.

kooshball avatar Apr 10 '18 16:04 kooshball

@kooshball - please provide more details, since i cannot reproduce that:

  • operating system info + vscode bitness if needed
  • simplest bash script source to reproduce the problem

rogalmic avatar Apr 10 '18 19:04 rogalmic

just wondering how to pass those bashdb params with this: bash --debugger [bash-options...] script-name [[--] script options]

according to http://bashdb.sourceforge.net/bashdb.html#Having-the-debugger-invoke-your-shell-script This method uses another script called bashdb which allows for giving its own options

it seems the drawback of using --debugger is failed to passing bashdb params.

tom-shan avatar Jul 17 '20 03:07 tom-shan

Hello everyone, any progress about this $0 limitation; when will it be fixed ?

batabek avatar Feb 24 '21 11:02 batabek

After investigation it turned out that "bash - - debugger" cannot be used. Hovever, bash 5.0 was supposed to allow setting $0 and this was done as far as I remember.

rogalmic avatar Feb 24 '21 13:02 rogalmic