Aw: Re: Inline `ifdef style` debugging

2011-08-11 Thread pjodrr
Hello, Am Montag, 8. August 2011 19:20:25 UTC+2 schrieb Steven W. Orr: > > if (( debug )) > then > _debug() > { > "$@" > # I do question whether this is a viable construct, versus > # eval "$@" > } > else > _debug() > { > : > } > f

RE: cond?true:false and division by 0

2011-08-11 Thread dnade.ext
Hello Sorry for the delay. I've applied your expr-noeval.patch file to the bash-4.2.10-4.fc15 package provided by fedora. The problem seems solved. :) Thanks ! D -- Damien Nadé Astek Sud-Est pour France Télécom - FT/OF/OFA/DMGP/PORTAIL/DOP/DEV/EAQS Sophia Antipolis - France /

Re: usenet to email gateway

2011-08-11 Thread Stephane CHAZELAS
2011-08-10 23:05:26 +, Karl Berry: > not sure who to report that to > > I've asked the FSF sysadmins. I can see from the mailing list > configuration that the gateway is intended to be operational, but don't > know how to debug what it happening from there. [...] Thanks Karl. My last su

Mailcheck during completion

2011-08-11 Thread Martin von Gagern
Hi! I often get a bash message about new mail during command line completion. Steps to reproduce: Type "ls ~/.bas" and press tab. Expected result: Command line completed to "ls ~/.bash" or whatever is right. Actual result: If new mails have arrived, the mail check is performed when pressing tab

completion handles variables inconsistently

2011-08-11 Thread Martin von Gagern
Hi! If the current word on the command line contains a shell variable, then the expansion works as if the variable had been expanded, but then quotes the variable. An example is probably a lot better than theory: Steps to reproduce 1. Type "echo $HOME/.bas" 2. Press tab 3. Press tab again Actual

Re: Re: Inline `ifdef style` debugging

2011-08-11 Thread Roger
> On Thu, Aug 11, 2011 at 12:23:00AM -0700, pjodrr wrote: >Hello, > >Am Montag, 8. August 2011 19:20:25 UTC+2 schrieb Steven W. Orr: >> >> if (( debug )) >> then >> _debug() >> { >> "$@" >> # I do question whether this is a viable construct, versus >> # eval "$

Re: saving bash.....

2011-08-11 Thread Eric Blake
On 08/10/2011 10:39 PM, Linda Walsh wrote: Chet Ramey wrote: > If not, then wouldn't > $((( ))) be turned into $( (( )) ), meaning the arith returns a > status, > and not the calculation. (I've tested this, and this is the case. Then I said: "It sounded to me like $(( )) would be translated in

Explanations of Changes in Bash 4.0 @ http://wiki.bash-hackers.org

2011-08-11 Thread Roger
Great website (http://wiki.bash-hackers.org) explaining the changes in bash-4.* along with all other versions. (The web pages also note it's not a full list of changes.) In the past, I've scanned Bash's ChangeLog and it didn't provide any meaningful explanations, just very brief details. (It wou

Re: Warning (HTML included to show prog shipped w/syntax highlighting).

2011-08-11 Thread Greg Wooledge
On Wed, Aug 10, 2011 at 03:23:47PM -0700, Linda W wrote: > 1 #!/bin/bash > 2 > 30 > 31 # trace control for subs > 32 declare -ix Allow_Trace=$((( > 33 _D_LowLevel | > 34 _D_Provides | > 35 _D_ > 36

Re: Explanations of Changes in Bash 4.0 @ http://wiki.bash-hackers.org

2011-08-11 Thread Roger
> On Thu, Aug 11, 2011 at 03:48:51AM -0800, Roger wrote: >Great website (http://wiki.bash-hackers.org) explaining the changes in bash-4.* >along with all other versions. (The web pages also note it's not a full list >of >changes.) > >In the past, I've scanned Bash's ChangeLog and it didn't provid

Re: Re: Inline `ifdef style` debugging

2011-08-11 Thread Greg Wooledge
On Thu, Aug 11, 2011 at 12:23:00AM -0700, pjodrr wrote: > they call it "collapsing functions": > http://wiki.bash-hackers.org/howto/collapsing_functions "The first time you run chatter(), the function redefines itself based on the value of verbose. Thereafter chatter doesn't check $verbose anymore

Aw: Re: Re: Inline `ifdef style` debugging

2011-08-11 Thread pjodrr
Am Donnerstag, 11. August 2011 14:13:27 UTC+2 schrieb Greg Wooledge: > The problem with this is that you can't switch to the other function > later. this is intended. The idea is to call a script with a debug or no-debug option. So for the runtime of the script the debug() function does not chan

Re: Bash source repository

2011-08-11 Thread Stephane CHAZELAS
2011-05-30, 06:34(+00), Michael Witten: [...] > Ben, it is generally a good idea to maintain the `Cc' list unless > explicitly asked. Beware that the bash mailing list also has a usenet interface (gnu.bash.bug) which has no notion of recipients let alone Cc. -- Stephane

Re: bug: return doesn't accept negative numbers

2011-08-11 Thread Stephane CHAZELAS
2011-08-08, 13:55(-07), Linda Walsh: [...] > and both 'exit' and 'return' should return error "ERANGE" if "--posix" is > set, and -1 is given. Iinvalid option doesn't make as much sense, in > this situtation, if it was -k or -m, sure...but in this case, it's a fact > that --posix artificially limi

Re: feature request: option to start script not from the very beginning of file

2011-08-11 Thread Stephane CHAZELAS
2011-08-02, 17:05(+04), Dmitry Bolshakov: [...] > perl has "-x" switch which makes it skip leading file contents until the > #!/bin/perl > line > > imho it would be good to have the same feature in bash What about: #! /bin/bash - :||:<<\#__END__ whatever you like here #__END__ your script star

Re: equivalent of Linux readlink -f in pure bash?

2011-08-11 Thread Stephane CHAZELAS
2011-08-9, 11:44(+10), Jon Seymour: > Has anyone ever come across an equivalent to Linux's readlink -f that > is implemented purely in bash? > > (I need readlink's function on AIX where it doesn't seem to be available). [...] What about: readlink_f() ( link=$1 max_iterations=40 while [ "$max_

Re: [OT] Re: feature request: option to start script not from the very beginning of file

2011-08-11 Thread Stephane CHAZELAS
2011-08-02, 23:41(+02), mhenn: > Am 02.08.2011 15:55, schrieb Stephane CHAZELAS: [...] >> What about: >> >> #! /bin/bash - >> :||:<<\#__END__ >> >> whatever you like here >> >> #__END__ [...] > Why did you use :||:<< ... > and not just :<<... ? > > when testing it, it doesn't make any difference

Re: equivalent of Linux readlink -f in pure bash?

2011-08-11 Thread Stephane CHAZELAS
2011-08-9, 09:24(+00), Stephane CHAZELAS: > 2011-08-9, 11:44(+10), Jon Seymour: >> Has anyone ever come across an equivalent to Linux's readlink -f that >> is implemented purely in bash? >> >> (I need readlink's function on AIX where it doesn't seem to be available). > [...] > > What about: > > rea

Re: equivalent of Linux readlink -f in pure bash?

2011-08-11 Thread Stephane CHAZELAS
2011-08-09, 11:29(+02), Bernd Eggink: > On 09.08.2011 03:44, Jon Seymour wrote: >> Has anyone ever come across an equivalent to Linux's readlink -f that >> is implemented purely in bash? > > You can find my version here: > > http://sudrala.de/en_d/shell-getlink.html > > As it contains some co

Re: equivalent of Linux readlink -f in pure bash?

2011-08-11 Thread Stephane CHAZELAS
2011-08-10, 12:00(+02), Bernd Eggink: [...] > function f > { > local OPTIND=1 > > echo "\$1=$1" > } > > while getopts "abcdefg" opt > do > echo "opt=$opt" > f $opt > done > > > Calling the sript like this works fine: > script -a -b -c > > B

Re: equivalent of Linux readlink -f in pure bash?

2011-08-11 Thread Stephane CHAZELAS
2011-08-09, 09:50(-04), Steven W. Orr: [...] > *) To remove the trailing slashes, instead of > > while [[ $file == */ ]] > do > file=${file%/} > done > > file=${file##*/}# file name > > just say > file="${file%${file

Aw: Re: Re: Inline `ifdef style` debugging

2011-08-11 Thread pjodrr
Am Donnerstag, 11. August 2011 12:40:24 UTC+2 schrieb Roger: > Just a quick response here, "ifdef style" is C code not compiled into the > compiled program if it is not defined or chosen to be enabled. This in turn, > prevents the CPU from wasting cycles testing if/then statements, etc... yes, I

Re: Is bash dying or dead (was Re: 4.1 is "$((( ))) an 'official operator, if $(( )) isn't?

2011-08-11 Thread Chet Ramey
On 8/10/11 10:59 PM, Clark J. Wang wrote: >> How can people write stable scripts in an enironment of constant change? >> This is creating the exact opposite of what POSIX is supposed to help! >> > > I found the similar problem. Bash has changed a lot since 2.05b which is the > 1st version of bas

Re: Mailcheck during completion

2011-08-11 Thread Chet Ramey
On 8/11/11 6:23 AM, Martin von Gagern wrote: > Hi! > > I often get a bash message about new mail during command line completion. > > Steps to reproduce: > Type "ls ~/.bas" and press tab. > > Expected result: > Command line completed to "ls ~/.bash" or whatever is right. > > Actual result: > If

Re: Mailcheck during completion

2011-08-11 Thread Martin von Gagern
Hi Chet, thanks for the swift reply! On 11.08.2011 15:54, Chet Ramey wrote: > I suspect that you have a completion defined for `ls' and it's running a > command or process substitution that's causing the mail check. Can you > run `set -x', then attempt the completion again and post the results?

Re: Mailcheck during completion

2011-08-11 Thread Chet Ramey
On 8/11/11 10:35 AM, Martin von Gagern wrote: > Hi Chet, > > thanks for the swift reply! > > On 11.08.2011 15:54, Chet Ramey wrote: >> I suspect that you have a completion defined for `ls' and it's running a >> command or process substitution that's causing the mail check. Can you >> run `set -x

Re: equivalent of Linux readlink -f in pure bash?

2011-08-11 Thread Bernd Eggink
On 09.08.2011 16:54, Stephane CHAZELAS wrote: 2011-08-09, 09:50(-04), Steven W. Orr: [...] *) To remove the trailing slashes, instead of while [[ $file == */ ]] do file=${file%/} done file=${file##*/}# file name jus

Re: Re: Inline `ifdef style` debugging

2011-08-11 Thread Roger
> On Thu, Aug 11, 2011 at 08:13:27AM -0400, Greg Wooledge wrote: >On Thu, Aug 11, 2011 at 12:23:00AM -0700, pjodrr wrote: >> they call it "collapsing functions": >> http://wiki.bash-hackers.org/howto/collapsing_functions > >"The first time you run chatter(), the function redefines itself based on t

Re: Re: Inline `ifdef style` debugging

2011-08-11 Thread Greg Wooledge
On Thu, Aug 11, 2011 at 12:38:17PM -0800, Roger wrote: > OK. Now I see the collapsing, and it seems more like a hidden collapse rather > then an immediately apparent collapse from an initial stance after > reading/tracing. When tracing this function, I was thinking the function > would be read eac

Re: bug: return doesn't accept negative numbers

2011-08-11 Thread Jon Seymour
On Mon, Aug 8, 2011 at 8:42 AM, Bob Proulx wrote: > > People sometimes read the POSIX standard today and think it is a > design document.  Let me correct that misunderstanding.  It is not. > POSIX is an operating system non-proliferation treaty. Love it! jon.

Re: Mailcheck during completion

2011-08-11 Thread Chet Ramey
On 8/11/11 10:44 AM, Chet Ramey wrote: > It's hard to say without a better idea of the problem. I suspected either > eval or command substitution because they cause re-entry into the shell > parser. I don't suspect command substitution because that explicitly turns > off interactive mode, but ev

Re: bug: return doesn't accept negative numbers

2011-08-11 Thread Linda Walsh
` Stephane CHAZELAS wrote: 2011-08-08, 13:55(-07), Linda Walsh: [...] and both 'exit' and 'return' should return error "ERANGE" if "--posix" is set, and -1 is given. Iinvalid option doesn't make as much sense, in this situtation, if it was -k or -m, sure...but in this case, it's a fact th

Re: saving bash.....(bash usefulness vs. being, orwellianly 'standardardized')

2011-08-11 Thread Linda Walsh
Eric Blake wrote: On 08/10/2011 10:39 PM, Linda Walsh wrote: "It sounded to me like $(( )) would be translated into "$( () )", turning off arithmetic expansion. Did I read that ___incorrectly__? Yes, you read it incorrectly. --- *thankyou* POSIX is saying that _if_ you want to