Running a Script- and debugging.

Jim mickeyboa at sbcglobal.net
Wed Sep 23 13:54:41 UTC 2009


On 09/23/2009 09:19 AM, Jim wrote:
> On 09/23/2009 12:11 AM, Nifty Fedora Mitch wrote:
>> On Tue, Sep 22, 2009 at 05:17:34PM -0430, Patrick O'Callaghan wrote:
>>> On Tue, 2009-09-22 at 15:46 -0400, Jim wrote:
>>>> Could someone give me a Ideal as to this part of a script would
>>>> hangup
>>>> script.
>>>> In FC11.
>>>>
>>>> The hangup stops at;
>>>>
>>>> cd 'dirname $0'
>>> $0 is usually the name of the script itself, so 'dirname $0' is the
>>> directory the script lives in. Changing to that directory shouldn't
>>> normally cause a hang, unless for example the directory is NFS-mounted,
>>> but without more information this is pure speculation.
>>>
>> Put some debugging in the script it is easy to make a copy.
>> We do not know what $0 is.
>>
>> We could have changed directory as expected and the
>> next command is hanging ya out to dry.  What is
>> the next command.  Is there a "trap" that has taken
>> the script to someplace unexpected.
>>
>> Also 'odd' things can happen if '.' and strange places
>> are in your PATH.   Are you running it as root via "su",
>> as root via "su -", as root via "sudo" or as yourself.
>>
>> What is the first line.  Is this a sh, bash or csh script or 
>> something else.
>> Some flags may be passed,
>>
>> To the copy add simple commands to get you some additional
>> information.
>>
>> Ideas....
>> $ cat bin/flubber
>> #!/bin/bash
>> pwd
>> echo foo
>> echo $0
>> dirname $0
>> cd 'dirname $0'
>> pwd
>>
>> =====
>> $ bin/flubber
>> /home/mydir
>> foo
>> bin/flubber
>> bin
>> bin/flubber: line 6: cd: dirname $0: No such file or directory
>> /home/mydir
>>
>> =====
>> If it "hangs" you might run it with "strace -f -o /tmp/tracelogfile 
>> script"
>>
>> =====
>> I do recall a bug fix going into bash that fixes a standards correctness
>> problem but has side effects because is it not "bug" compatable.
>> You can grab an OLDer version of bash and install it in a SAFE place
>> with rpm and try it.  I just do not recall the details and they do
>> not matter -- it is easy to test for.  It is also easy to look at the
>> change log for the bash rpm and read the bug reports.  Use rpm or yum,
>> Example using rpm:
>>   # which bash
>>   # rpm -qf /bin/bash
>>   # rpm -qi bash
>>   # rpm -q --changelog bash
>>
>>
>>
> Mitch you DID IT !!  su - instead of su
>
Thanks guys, for all your help, I couldn't have done without it.
This Samsung CLX3175FN is one nice printer , it even checks the ink levels.
Now I'm having problems with Cups and the printer with connecting after 
driver setup. - SU  verses SU did the the trick.
I'm going to have to do some more troubleshooting.




More information about the users mailing list