tracing inside functions

2007-05-31 Thread Nic James Ferrier
Using bash 2.05, does anyone know of a way to get a trace of what's
happening inside a function?

eg file /root/myscript:

  #!/bin/bash

  function x
  {
  LIST=`ls /someplace`
  [ "$LIST" == "" ] && exit 0
  
  mv $LIST /tmp
  }

  x

and then:

  bash -x /root/myscript

will only show:

  x

I'd like to see inside the function.

Bash 3 looks like it has extra debug stuff under shopt... but not
2.05.

Any clues?

-- 
Nic Ferrier
http://www.tapsellferrier.co.uk   


___
Bug-bash mailing list
Bug-bash@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-bash


Error: Unexpected "(" in "...`(..."

2007-05-31 Thread tjoen
Configuration Information [Automatically generated, do not change]:
Machine: i386
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='i386' 
-DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='i386-pc-linux-gnu' 
-DCONF_VENDOR='pc' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash' -DSHELL 
-DHAVE_CONFIG_H   -I.  -I. -I./include -I./lib   -g -O2
uname output: Linux localhost.localdomain 2.6.21.2 #1 Fri May 25 01:14:17 CEST 
2007 i686 GNU/Linux
Machine Type: i386-pc-linux-gnu

Bash Version: 3.2
Patch Level: 0
Release Status: release

Description:
Tested with 3.1: no problems
3.2 has problems with lines like:
RUBYDIR=`($RUBY -rmkmf -e 'print Config::CONFIG["archdir"] || 
$archdir') 2>/dev/null`

Repeat-By:
ftp://$SOURCEFORGEMIRROR/s/sw/swig/swig-1.3.31.tar.gz
run ./configure


___
Bug-bash mailing list
Bug-bash@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-bash


Re: Error: Unexpected "(" in "...`(..."

2007-05-31 Thread Chet Ramey
[EMAIL PROTECTED] wrote:

> Bash Version: 3.2
> Patch Level: 0
> Release Status: release
> 
> Description:
>   Tested with 3.1: no problems
>   3.2 has problems with lines like:
>   RUBYDIR=`($RUBY -rmkmf -e 'print Config::CONFIG["archdir"] || 
> $archdir') 2>/dev/null`

I can't reproduce this with the above construct in isolation, using either
the initial or a fully-patched version of bash-3.2.

Chet
-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
   Live Strong.  No day but today.
Chet Ramey, ITS, CWRU[EMAIL PROTECTED]http://cnswww.cns.cwru.edu/~chet/


___
Bug-bash mailing list
Bug-bash@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-bash


Re: tracing inside functions

2007-05-31 Thread Paul Jarc
Nic James Ferrier <[EMAIL PROTECTED]> wrote:
> Using bash 2.05, does anyone know of a way to get a trace of what's
> happening inside a function?

You can add "set -x" at the top of the function body.  I don't know of
any way to get a similar effect without editing the script.


paul


___
Bug-bash mailing list
Bug-bash@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-bash


Re: tracing inside functions

2007-05-31 Thread Chet Ramey
Nic James Ferrier wrote:
> Using bash 2.05, does anyone know of a way to get a trace of what's
> happening inside a function?

Only by adding `set -x' inside the function body.

Chet


-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
   Live Strong.  No day but today.
Chet Ramey, ITS, CWRU[EMAIL PROTECTED]http://cnswww.cns.cwru.edu/~chet/


___
Bug-bash mailing list
Bug-bash@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-bash


Re: tracing inside functions

2007-05-31 Thread Andreas Schwab
Chet Ramey <[EMAIL PROTECTED]> writes:

> Nic James Ferrier wrote:
>> Using bash 2.05, does anyone know of a way to get a trace of what's
>> happening inside a function?
>
> Only by adding `set -x' inside the function body.

Or by upgrading to a shell that is not 6 years old. :-)

Andreas.

-- 
Andreas Schwab, SuSE Labs, [EMAIL PROTECTED]
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."


___
Bug-bash mailing list
Bug-bash@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-bash


Re: Error: Unexpected "(" in "...`(..."

2007-05-31 Thread Chet Ramey
tjoen wrote:

> I have no problems with that line after the prompt too.
> The problem only appears in the configure-script of swig.
> I forgot to mention that I have no ruby installed
> and that I have tried the option --without-ruby
> but with the same result:
> 
> checking whether Guile's gh_ API works... no
> checking whether Guile's SCM_ API works... no
> ./configure: line 7487: syntax error near unexpected token `('
> ./configure: line 7487: `   RUBYDIR=`($RUBY -rmkmf -e 'print 
> Config::CONFIG["archdir"] || $archdir') 2>/dev/null`'

I was able to run configure without errors using bash-3.2.17.  I encourage
you to apply the available bash-3.2 patches and try it again.

Chet

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
   Live Strong.  No day but today.
Chet Ramey, ITS, CWRU[EMAIL PROTECTED]http://cnswww.cns.cwru.edu/~chet/


___
Bug-bash mailing list
Bug-bash@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-bash