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

2011-08-11 Thread Clark J. Wang
On Wed, Aug 10, 2011 at 6:00 PM, Bernd Eggink mono...@sudrala.de wrote: On 09.08.2011 15:50, Steven W. Orr wrote: *) You reset OPTIND to 1 but you didn't declare it local. This will cause any caller of getlink which uses getopts to reset its variable to 1. (I mention this because it cost me

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() { : } fi on

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

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,

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 $@ } else

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 into

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

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 ))) I

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 provide any

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, it

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

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 limits exit

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: [...] Without :||, it

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: readlink_f() (

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 corrections

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 bash I've

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 new mails have

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', then

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

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 the value

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 each

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 b...@proulx.com 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 eval

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 that