Menu

#2 Step into shell script call.

1.0
closed
question (1)
2019-10-20
2019-10-17
No

Is there a way to get inside a nested call to bash script.
Example: https://github.com/AladW/aurutils/blob/master/lib/aur-sync#L172
Where aur is a bash script /usr/bin/aur that passes its arguments to another bash script /usr/lib/aurutils/aur-repo.

btw. Why not move this project to GitHub, likt zshdb :)

Discussion

  • Rocky Bernstein

    Rocky Bernstein - 2019-10-18

    I don't have a clear idea of the scope what you are expecting let alone how to implement that in the bash debugger bashdb.

    Often when I want to debug shell scripts inside other shell scripts, I create a little wrapper shell script like this in file ~/bin:/aur

    #!/usr/bin/env bash
    PROGRAM=/usr/bin/aur
    if [[ $DEBUG_SCRIPT == 'bashdb' ]]; then
        exec bashdb  $PROGRAM -- "$@"
    else
        exec $PROGRAM "$@"
    fi
    

    Then I make sure that my PATH is arranged to call ~/bin over the one in /usr/bin. And I set
    environment variable $DEBUG_SCRIPT to" bashdb".

    If you want an envornment variable that you can test if you are already inside bashdb, you can use _Dbg_DEBUGGER_LEVEL.

    As for bashdb and sourceforge. This project predates github, I am appreciative to sourceforge for hosting this project all of these years. And it is not a bad idea not to put all of one's eggs in one github service.

     

    Last edit: Rocky Bernstein 2019-10-18
  • szczepaniak bartek

    Thanks for shraring this tip, I've just fought thare is something like step inside which test the next script line with something like grep -q shell\ script <(file $(which cd)) and if it's a bash script it exec it with bashdb.

     

    Last edit: szczepaniak bartek 2019-10-19
  • Rocky Bernstein

    Rocky Bernstein - 2019-10-19

    That is called the "debug" command. See http://bashdb.sourceforge.net/bashdb.html#Debug

    I spent a lot of time documenting the debugger. Please make more use of it.

     

    Last edit: Rocky Bernstein 2019-10-19
  • Rocky Bernstein

    Rocky Bernstein - 2019-10-19
    • labels: --> question
    • status: open --> closed
    • assigned_to: Rocky Bernstein
     
    • szczepaniak bartek

      Sorry for my ignorance, and I appreciate your help - I'm going to study the manual inside out now ;)

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.