On Fri, 9 Jan 2009, Adam Monsen wrote:

> Anyone know why I can't invoke the Bash debugger from inside a Bash 
> script on Ubuntu 8.10?
>
> I've installed the bash debugger like so:
>
>  sudo apt-get install bashdb
>
> I can debug full Bash scripts just fine:
>
>  bashdb test.sh
>
> But when I run this script, which, according to the bashdb documentation
> is one of the steps in starting the debugger within a script:
>
> --------------------------8<--------------------------
> #!/bin/bash
> source /usr/share/bashdb/bashdb-trace
> -------------------------->8--------------------------
>
> I get the following error:
> --------------------------8<--------------------------
> test.sh: cannot read .  Perhaps bashdb is installed wrong.
> test.sh: or try using -L (with a different directory).
> -------------------------->8--------------------------
>
> Any ideas?


What happens when you run this on the bash command line:

source /usr/share/bashdb/bashdb-trace

The error message is that it "cannot read ."  So is bashdb-trace trying to 
read something in the default directory that it isn't finding?

A mistake I sometimes make, which might not apply here, is to forget that 
the environment in the script is different in some way -- like it doesn't 
know the path or something.  Usually that happens when I execute the 
script as root in a crontab or using sudo.

Mike

P.S. -- A "gotcha" from last night:  I was trying to scp a file into 
/usr/local/src and it kept failing.  Then I realized it was because I 
didn't have write permissions in /usr/local/src on the local machine so I 
tried "sudo scp ..." and that also failed, but for a different reason: 
It was because I was then trying to login as root, which was disallowed 
and had a different password.

Joke:  A guy says to his wife "make me a sandwich."  She says "no."  So he 
says "sudo make me a sandwich" and she says "OK."  (I think I stole that 
one from xkcd.)