Re: Segmentation fault

2007-12-12 Thread Jan Schampera
Chet Ramey wrote: > seba wrote: >> #!/bin/sh >> >> fib() { > You managed to write yourself an infinitely-recursive function, and > eventually ran out of stack space. `==' is a string operator, not a > numeric operator, when used with `['. Most likely. When I test this and it breaks, the stack h

Re: Please advise on bash programming tactics/strategy

2007-12-12 Thread cga2000
On Wed, Dec 12, 2007 at 12:31:47AM EST, Bob Proulx wrote: > cga2000 wrote: > > I was wondering if there is any way I can convince netstat to return > > its output to bash variables for additional processing. > > Do you mean like this? > > rxcnt=$(netstat -ni | awk '/^eth0/{print$4}') Precise

Re: Many FSCTL_PIPE_PEEK operations?

2007-12-12 Thread Chet Ramey
Gary Fritz wrote: > I just installed SysInternals' FileMon utility and have discovered all > kinds of unknown activity going on behind the scenes. > > One that surprised me was Bash. FileMon says that Bash is doing 90-100 > FSCTL_PIPE_SEEK operations EVERY SECOND! It does this even if a comman

Re: Segmentation fault

2007-12-12 Thread Chet Ramey
seba wrote: > GNU bash, version 3.2.25(1)-release (i686-pc-linux-gnu) > Copyright (C) 2005 Free Software Foundation, Inc. > > #!/bin/sh > > fib() { >n=$1 >[ $n == 0 -o $n == 1 ] && return $n >fib $(($n-1)) >ret1=$? >fib $(($n-2)) >ret2=$? >r

Re: Problem with pattern replacing when STRING is an expandable char

2007-12-12 Thread Mike Stroyan
> > Repeat-By: > a=111.1 > echo ${a//[0-9]/x} > > correctly gives "xxx.x", but > > echo ${a//[0-9]/*} > > gives a listing of files in current directory. Seems that the "*" > is expanded before replacing the pattern. > > It workes the right way at least up to bash-3.1.17(

Re: unset strangely rejects certain function names eg fu~

2007-12-12 Thread Andreas Schwab
[EMAIL PROTECTED] writes: > Repeat-By: > $ function fun(){ echo running fun;} > $ function fu~(){ echo running fu~;} > $ fun > running fun > $ fu~ > running fu~ > $ unset fun > $ unset fu~ > bash: unset: `fu~': not

Re: Problem with pattern replacing when STRING is an expandable char

2007-12-12 Thread Andreas Schwab
Heinz-Ado Arnolds <[EMAIL PROTECTED]> writes: > Repeat-By: > a=111.1 > echo ${a//[0-9]/x} > > correctly gives "xxx.x", but > > echo ${a//[0-9]/*} > > gives a listing of files in current directory. Only those that contain a period. > Seems that the "*" > is expanded be

Re: unset strangely rejects certain function names eg fu~

2007-12-12 Thread Paul Jarc
[EMAIL PROTECTED] wrote: > $ unset fu~ > bash: unset: `fu~': not a valid identifier You can use "unset -f" to unset a function whose name doesn't fit the rules for variable names. paul

Re: Problem with pattern replacing when STRING is an expandable char

2007-12-12 Thread Paul Jarc
Heinz-Ado Arnolds <[EMAIL PROTECTED]> wrote: > a=111.1 > echo ${a//[0-9]/x} > > correctly gives "xxx.x", but > > echo ${a//[0-9]/*} > > gives a listing of files in current directory. Seems that the "*" > is expanded before replacing the pattern. No, it's expanded afterward,

Re: unset strangely rejects certain function names eg fu~

2007-12-12 Thread Bob Proulx
> unset strangely rejects certain function names eg fu~ > $ function fun(){ echo running fun;} > $ function fu~(){ echo running fu~;} > $ fun > running fun > $ fu~ > running fu~ > $ unset fun > $ unset fu~ >

Segmentation fault

2007-12-12 Thread seba
GNU bash, version 3.2.25(1)-release (i686-pc-linux-gnu) Copyright (C) 2005 Free Software Foundation, Inc. #!/bin/sh fib() { n=$1 [ $n == 0 -o $n == 1 ] && return $n fib $(($n-1)) ret1=$? fib $(($n-2)) ret2=$? return $(($ret1 + $ret2)) } for ((i=0

unset strangely rejects certain function names eg fu~

2007-12-12 Thread root
Configuration Information [Automatically generated, do not change]: Machine: i686 OS: linux-gnu Compiler: gcc Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='i686' -DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='i686-redhat-linux-gnu' -DCONF_VENDOR='redhat' -DLOCALEDIR='/usr/share/locale' -DPAC

Please advise on programming tactics/strategy

2007-12-12 Thread cga2000
I was wondering if there is any way I can convince netstat to return its output to bash variables for processing. Pretty simple logic: Do forever: Call netstat to obtain RX & TX byte counts Print delta {current .. minus previous .. byte counts} Save current byte counts Wait for a secon

Problem with pattern replacing when STRING is an expandable char

2007-12-12 Thread Heinz-Ado Arnolds
Configuration Information [Automatically generated, do not change]: Machine: i686 OS: linux-gnu Compiler: gcc Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='i686' -DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='i686-pc-linux-gnu' -DCONF_VENDOR='pc' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='b

Many FSCTL_PIPE_PEEK operations?

2007-12-12 Thread Gary Fritz
I just installed SysInternals' FileMon utility and have discovered all kinds of unknown activity going on behind the scenes. One that surprised me was Bash. FileMon says that Bash is doing 90-100 FSCTL_PIPE_SEEK operations EVERY SECOND! It does this even if a command is running, so there is n