Running a Script- and debugging.

suvayu ali fatkasuvayu+linux at
Tue Sep 22 18:37:35 UTC 2009

2009/9/22 Jim <mickeyboa at>:
> On 09/22/2009 12:07 PM, suvayu ali wrote:
>> 2009/9/22 Jim<mickeyboa at>:
>>> On 09/22/2009 11:05 AM, Patrick O'Callaghan wrote:
>>>> On Tue, 2009-09-22 at 10:52 -0400, Jim wrote:
>>>>> FC11/KDE
>>>>> I have a script to run for setting up a Samsung CLX3175FN, when I start
>>>>> it it hangs. and doesn't say why , how can I find why it hangs ?
>>>>> I'm running it from the terminal as root.
>>>> If it's a Shell script (you don't say) try running it as "sh -x
>>>>" or "sh -v".
>>>> poc
>>> Thanks Patrick for yor responds.
>>> Using the sh -x command shows me to where it stopped.
>>> What app. in Linux could I use that would show the line # and have the
>>> Find
>>> a line in it.
>>> The Console does not have a "find" command in it.
>>> Prefer a app. that is not a command line app.  I'm not very good at "vi"
>>> and
>>> some of the others.

What you can do is use,

$ grep -ne 'the command the script fails at' /path/to/script

This will give you the line number, then you can open it in any editor
and look it up. Since you mention you prefer something simpler, I'm
out of suggestions as I use Emacs and it is far from simple. However
if you still want to give that a try, then open emacs like this,

$ emacs +line_no /path/to/script

This will open the script with the cursor at line line_no. If you want
to turn on line numbers in emacs, do `Alt+x linum-mode <RET>'

>> I haven't tried this yet, but you could give bashdb a try. Sounds very
>> useful.
>> Name       : bashdb
>> Arch       : noarch
> Thanks Suvayu it looks very impressive.
> I ran the script I was having problems with and I have attached it.
> I'm under the GUN here to get a Samsung CLX3175FN printer working, Samsung
> has drivers for linux but they won't work in Fedora 11 .The
> script is hanging up on me.
> This sure is a nice printer.


Once you are at this prompt you can look at what are the values for
all the variables, exit codes and so on ... As I said, I haven't used
the package yet. So can't help you with the specifics. Try looking at
the man page for bashdb, that should have basic guidelines on how to
use it.



Open source is the future. It sets us free.

More information about the users mailing list