Re: inconsistency with "readonly" and scope

2012-04-13 Thread Linda Walsh
Chet Ramey wrote: This is intended. Bash doesn't allow a local copy of a variable to override a readonly global one. This can be a potential security hole, --- You can look at it that way, but it also hinders modular programming. If I declare a variable to be local, I wouldn't expect it t

Re: how are aliases exported?

2012-04-13 Thread Linda Walsh
Dennis Williamson wrote: Aliases are intended for command line convenience. You should use functions, which can be exported and are the correct thing to use in scripts (and even from the command line). "For almost every purpose, shell functions are preferred over aliases." But, of course, yo

how are aliases exported?

2012-04-13 Thread Linda Walsh
How can I export an alias so it survives across an exec? I thought there was a way for them to be exported like vars or functions... but neither work. I have a prog that needs an alias defined, if it isn't, it execs a program to define the alias which re-execs the first -- if the alias isn'

Re: status on $[arith] for eval arith vsl $((arith))??

2012-04-11 Thread Linda Walsh
Greg Wooledge wrote: On Wed, Apr 11, 2012 at 02:34:01AM -0700, Linda Walsh wrote: - for ((vl=$((v_level - 1)); $vl > 0; --vl)) The inside of the for ((...)) is already a math context. You don't need another $((...)) inside it. for ((vl = v_level - 1; vl > 0; --vl)) Or is t

Re: status on $[arith] for eval arith vsl $((arith))??

2012-04-11 Thread Linda Walsh
Chet Ramey wrote: On 4/9/12 9:07 PM, Linda Walsh wrote: ** linux-kernel -- all over the place... At that point, I was getting too many to keep up with ... so I stopped searching... $[] has is -- I would bet, Universally, used MORE than $(())... I believe you'd lose, but it's

Re: status on $[arith] for eval arith vsl $((arith))??

2012-04-09 Thread Linda Walsh
Maarten Billemont wrote: Any particular reason for not removing old undocumented functionality, or is that mostly the nature of this beast - dragging along and maintaining ancient code for the sake of compatibility? So 'yesturday' is "ancient" for you?... that's really means somet

Re: status on $[arith] for eval arith vsl $((arith))??

2012-04-09 Thread Linda Walsh
Maarten Billemont wrote: On 08 Apr 2012, at 21:30, Chet Ramey wrote: On 4/8/12 3:02 PM, Maarten Billemont wrote: Any particular reason for not removing old undocumented functionality, or is that mostly the nature of this beast - dragging along and maintaining ancient code for the sake of

Re: status on $[arith] for eval arith vsl $((arith))??

2012-04-07 Thread Linda Walsh
Mike Frysinger wrote: On Saturday 07 April 2012 16:45:55 Linda Walsh wrote: Is it an accidental omission from the bash manpage? it's in the man page. read the "Arithmetic Expansion" section. -mike My 4.2 manpage says: Arithmetic Expansion Arithmetic e

status on $[arith] for eval arith vsl $((arith))??

2012-04-07 Thread Linda Walsh
In modifying some released code on my distro,I ran into the extensive use of $[arith] as a means for returning arithmetic evaluations of the expression. I vaguely remember something like that from years ago, but never see any reference to it -- yet it works, and old code seems to r

Re: semicolon at beginning of line

2012-04-07 Thread Linda Walsh
Elliott Forney wrote: I wish bash would happily execute lines that begin with a semicolon, i.e., treat it as a no-op followed by a command. The following examples come to mind: $ infloop& echo hello hello $ infloop&; echo hello bash: syntax error near unexpected token `;' $ echo hello; ec

Re: Expanding aliases to full command before execution

2012-04-06 Thread Linda Walsh
Greg Wooledge wrote: On Wed, Apr 04, 2012 at 04:08:04PM -0700, Linda Walsh wrote: function ll { ... } Just for the record, a one-line function definition requires a ; before the closing curly brace. ll() { ls -l "$@";} --- Can you say 'irrelevant detail'

Re: weird behavior of set -e

2012-04-04 Thread Linda Walsh
mhenn wrote: Am 24.06.2011 11:51, schrieb Harald Dunkel: Hi folks, A colleague pointed me to this problem: If I run ( set -e; ( false; echo x ) ) in bash 4.1.5, then there is no screen output, as expected. If I change this to ( set -e; ( false; echo x ) || echo y ) then I get

Re: Expanding aliases to full command before execution

2012-04-04 Thread Linda Walsh
jrrand...@gmail.com wrote: function expand_alias() # expand an alias to full command { if [ "$1" = "." ]; then argument="\\$1" else argument="$1" fi match=$( alias -p | grep -w "alias $argument=" ) if [ -n "$match" ]; then expanded="`

Re: bash 4.2 breaks source finding libs in lib/filename...

2012-03-02 Thread Linda Walsh
:34:21 -0800 From: Linda Walsh To: bug-bash I have several files that ***source*** the ***lib*** files*** by expecting the name of the lib to be checked against PATH -- How look up [lib] files relative to PATH regardless of them having a '/' in them? --- You are welcome! N

Re: RFE: allow bash to have libraries

2012-03-01 Thread Linda Walsh
John Kearney wrote: ... [large repetitive included text elided...] why not just do something like this? <26 line suggested 'header' elided...> gives you more control anyway, pretty quick and simple. At least 30% of the point of this is to take large amounts of common initializatio

Re: bash 4.2 breaks source finding libs in lib/filename...

2012-02-29 Thread Linda Walsh
Greg Wooledge wrote: On Wed, Feb 29, 2012 at 11:26:06AM -0800, Linda Walsh wrote: Greg Wooledge wrote: Any pathname that contains a / should not be subject to PATH searching. You are alone in this opinion -- as most application don't follow that rule. ??

Re: RFE: allow bash to have libraries (was bash 4.2 breaks source finding libs in lib/filename...)

2012-02-29 Thread Linda Walsh
Eric Blake wrote: On 02/29/2012 12:26 PM, Linda Walsh wrote: Any pathname that contains a / should not be subject to PATH searching. Agreed - as this behavior is _mandated_ by POSIX, for both sh(1) and for execlp(2) and friends. Is it that you don't read english as a first languag

Re: bash 4.2 breaks source finding libs in lib/filename...

2012-02-29 Thread Linda Walsh
Greg Wooledge wrote: On Tue, Feb 28, 2012 at 05:34:21PM -0800, Linda Walsh wrote: How can one get the same behavior as before and look up files relative to PATH regardless of them having a '/' in them? What? That sounds like it WAS a bug before, and you had somehow interpret

bash 4.2 breaks source finding libs in lib/filename...

2012-02-28 Thread Linda Walsh
I have several files that source the lib files by expecting the name of the lib to be checked against PATH -- but this no longer works when the library is in lib/filename. How can one get the same behavior as before and look up files relative to PATH regardless of them having a '/' in them? Why

Re: Fix u32toutf8 so it encodes values > 0xFFFF correctly.

2012-02-22 Thread Linda Walsh
Eric Blake wrote: Don't think of it as 'wide-int', rather, think of it as 'the integral type that both contains wchar_t and WEOF'. You cannot write 'signed wint_t' nor 'unsigned 'wint_t'. --- ?? You say don't think of it that way, but unless I missed something, just like wchar stood for '

Re: Fix u32toutf8 so it encodes values > 0xFFFF correctly.

2012-02-22 Thread Linda Walsh
Eric Blake wrote: On 02/22/2012 05:19 AM, Linda Walsh wrote: Eric Blake wrote: Not only can wchar_t can be either signed or unsigned, you also have to worry about platforms where it is only 16 bits, such as cygwin; on the other hand, wint_t is always 32 bits, but you still have the issue

Re: Fix u32toutf8 so it encodes values > 0xFFFF correctly.

2012-02-22 Thread Linda Walsh
Eric Blake wrote: Not only can wchar_t can be either signed or unsigned, you also have to worry about platforms where it is only 16 bits, such as cygwin; on the other hand, wint_t is always 32 bits, but you still have the issue that it can be either signed or unsigned. What platform uses

OT Re: set -e in (subshells) does not work independently of outer context

2012-02-08 Thread Linda Walsh
Chet Ramey wrote: On 2/8/12 9:28 PM, Linda Walsh wrote: Please note, I didn't compare anyone or their actions to those of Nazi's, This discussion has gone on for a long time; the probability of a comparison involving Nazis hit 1; ipso facto, Godwin's Law holds. Bu

Re: set -e in (subshells) does not work independently of outer context

2012-02-08 Thread Linda Walsh
ke fashion, THOUGH, if we wanted to compare and look at those who are engaged in dictatorial actions, and those who are more commonly marginalized as outsiders, I'm sure such a comparison would be 'pointless' (though ironic). Chet Ramey wrote: On 2/8/12 6:31 PM, Linda Walsh wrot

Re: set -e in (subshells) does not work independently of outer context

2012-02-08 Thread Linda Walsh
Eric Blake wrote: On 01/30/2012 02:27 PM, Linda Walsh wrote: Chet Ramey wrote: As Eric said, the other parts of the Posix description make it clear that the `ignoring set -e' status is inherited by subshells. The original POSIX standard made this clear -- in that it was o

Re: set -e in (subshells) does not work independently of outer context

2012-01-30 Thread Linda Walsh
Chet Ramey wrote: As Eric said, the other parts of the Posix description make it clear that the `ignoring set -e' status is inherited by subshells. The original POSIX standard made this clear -- in that it was only a failure of a 'simple' command that resulted' in an err-exit'.

(low priority) BUG: too large history=nohistory? (was: Re: How to enable infinite command history)

2012-01-30 Thread Linda Walsh
It seems there is a a platform dependent bug somewhere: > HISTSIZE=$(((3**15)) echo $HISTSIZE 1000 --- but you have no history... Pierre Gaston wrote: Setting HISTFILESIZE to 2147483647 gives you 68 years of history at one command per seconds (I hope I got my math right) with say

Re: bash man page needs more examples...(i.e. >0)

2012-01-30 Thread Linda Walsh
DJ Mills wrote: OK. �How about if that sentence began with `When specifying n, the digits greater ...'? declare -i foo; foo=20#a2; echo "$foo" 202 [base#]n, 'base' is a INTEGER 2-64, then '#', followed by the number. --- Slightly more exact/pedantic, how about: Syntax for integer cons

Re: bash man page needs more examples...(i.e. >0)

2012-01-30 Thread Linda Walsh
DJ Mills wrote: OK. �How about if that sentence began with `When specifying n, the digits greater ...'? declare -i foo; foo=20#a2; echo "$foo" 202 [base#]n, 'base' is a INTEGER 2-64, then '#', followed by the number. ^^^ That's much more clear!

Re: bash man page needs more examples...(i.e. >0)

2012-01-29 Thread Linda Walsh
Andreas Schwab wrote: Linda Walsh writes: var=0a32; echo $var -bash: 0a32: value too great for base (error token is "0a32") Which part of "Constants with a leading 0 are interpreted as octal numbers" did you not understand? The part that said the ones that

bash man page needs more examples...(i.e. >0)

2012-01-28 Thread Linda Walsh
reading the section no constants: Constants with a leading 0 are interpreted as octal numbers. A leading 0x or 0X denotes hexadecimal. Otherwise, numbers take the form [base#]n, where base is a decimal number between 2 and 64 representing the arithmetic base,

Re: read -ei "y" -p "> " bug(s)

2012-01-19 Thread Linda Walsh
Chet Ramey wrote: On 1/14/12 12:49 AM, Linda Walsh wrote: /* vim: ts=1 sw=1 et sc fo=cqwa1 tw=78 syntax=css */ There's actually 1 parts 2 this, I ran into the 2nd while testing the first... Like Greg Wooledge, I wasn't able to reproduce the second issue with `read -N 1

read -ei "y" -p "> " bug(s)

2012-01-13 Thread Linda Walsh
/* vim: ts=1 sw=1 et sc fo=cqwa1 tw=78 syntax=css */ There's actually 1 parts 2 this, I ran into the 2nd while testing the first... I wanted to be able to check the keyboard if the user had 'typed' ahead, and mean to answer an upcoming question on purpose or if it was left over from a previou

Re: Specify completion without name

2012-01-11 Thread Linda Walsh
Clark J. Wang wrote: On Fri, Jan 6, 2012 at 00:33, Peng Yu wrote: But beware to clearly document these by giving working EXAMPLE code which include these three commands (not just text explanation without working code, by "working code" I mean code snippet is discouraged, a complete completio

Re: How to match regex in bash? (any character)

2011-11-17 Thread Linda Walsh
Chet Ramey wrote: On 9/27/11 6:41 PM, Roger wrote: Correct. After reading the entire Bash Manual page, I didn't see much mention of documentation resources (of ERE) besides maybe something about egrep from Bash's Manual Page or elsewhere on the web. After extensive research for regex/regex

bash: while: command not found? ??

2011-11-07 Thread Linda Walsh
At the # prompt, if I type: #

OT: characters sets in mail headers (was: Accents)

2011-08-25 Thread Linda Walsh
Thomas De Contes wrote: Le 25 août 2011 à 14:36, Greg Wooledge a écrit : On Wed, Aug 24, 2011 at 06:51:32PM -0700, Linda Walsh wrote: BTW, Thomas -- what is the Character that comes after 'De' in your name? I read it as hex '0xc282c2' which doesn't

Re: accents

2011-08-25 Thread Linda Walsh
` Greg Wooledge wrote: On Wed, Aug 24, 2011 at 06:51:32PM -0700, Linda Walsh wrote: BTW, Thomas -- what is the Character that comes after 'De' in your name? I read it as hex '0xc282c2' which doesn't seem to be valid unicode. RFC 2822 (section 2.2) says

Re: accents

2011-08-24 Thread Linda Walsh
Chet Ramey wrote: In yours, however, it is 0x65 0xcc 0x81 which is U+0065 LATIN SMALL LETTER E followed by U+0301 COMBINING ACUTE ACCENT. That's not valid UTF-8, since UTF-8 requires that the shortest sequence be used to encode a character. This is exactly true... Valid UTF-8 is anythi

Re: Syntax Question...

2011-08-18 Thread Linda Walsh
Greg Wooledge wrote: On Tue, Aug 16, 2011 at 03:41:19PM -0700, Linda Walsh wrote: > Ken Irving wrote: >> Maybe this? today_snaps=( ${snap_prefix} ) > but as you mention, that will put them into an arraysorry > "imprecise terminology" list for me is some n

general bash oddities and discussion (was Re: Syntax Question...)

2011-08-18 Thread Linda Walsh
` Greg Wooledge wrote: Now that one is suprising, as it's supposed to take the output of the ... hmmm.yup!... that's exactly what it does. takes the work and executes it and returns the results on stdin as a single quoted blob of output: > read a <<< *.txt > echo $a apc_c

Re: Syntax Question...

2011-08-18 Thread Linda Walsh
` Chet Ramey wrote: On 8/18/11 9:37 AM, Greg Wooledge wrote: The word following the redirection operator in the following descrip- tions, unless otherwise noted, is subjected to brace expansion, tilde expansion, parameter expansion, command substitution, arithmetic expan???

Re: conditional aliases are broken

2011-08-18 Thread Linda Walsh
` Greg Wooledge wrote: On Thu, Aug 18, 2011 at 08:03:41AM -0700, Linda Walsh wrote: 4.2 introduce a new -g to declare a global variable inside a function. Which doesn't say what it would do in situations like the above. Then let's test: imadev:~$ echo $BA

Re: Syntax Question...

2011-08-18 Thread Linda Walsh
Pierre Gaston wrote: l understood a while ago, now I'll just stop feeding the troll. --- You obviously feel there needs to be a right and wrong, and if you haven't made me wrong, you've lost -- indicated by your resorting to name calling rather than discussing issues. Sigh.

Re: Syntax Question...

2011-08-18 Thread Linda Walsh
` Greg Wooledge wrote: On Thu, Aug 18, 2011 at 06:02:14AM -0700, Linda Walsh wrote: The "shopt -s expand_aliases" feature has been in bash since I first encountered it in ~1999. Fine. You know more bash bad practices than I do. You win. Just because you didn'

Re: conditional aliases are broken

2011-08-18 Thread Linda Walsh
Pierre Gaston wrote: Is this a question? or are you trying to make a point? It is both -- a chance to find answer to a question, or make the point that aliases in scripts have a useful purposes that can't be replaced by function clls. For the question (If I understand correctly): 1) Most

Re: Syntax Question...

2011-08-18 Thread Linda Walsh
Pierre Gaston wrote: On Mon, Aug 15, 2011 at 2:31 AM, Linda Walsh wrote: Re: BashFAQ/006: http://mywiki.wooledge.org/BashFAQ/006 Pierre Gaston wrote: Linda: please show quote the section that shows using an variable that holds the name of an array to be used (and

Re: Syntax Question...

2011-08-18 Thread Linda Walsh
Greg Wooledge wrote: [[[ yeah, am running a bit behind]... On Mon, Aug 15, 2011 at 12:45:58AM -0700, Linda Walsh wrote: > #!/bin/bash -exu > +[shopt -s expand_aliases extglob] > > alias sub=function > alias unless='if !' Aliases don't even *work* in s

Re: conditional aliases are broken

2011-08-17 Thread Linda Walsh
` Eric Blake wrote: On 08/15/2011 04:40 PM, Sam Steingold wrote: * Andreas Schwab [2011-08-15 22:04:04 +0200]: Sam Steingold writes: Cool. Now, what does this imply? "For almost every purpose, shell functions are preferred over aliases." so, how do I write alias a=b as a function? (

Re: Syntax Question...

2011-08-16 Thread Linda Walsh
Ken Irving wrote: On Mon, Aug 15, 2011 at 08:19:01PM -0700, Linda Walsh wrote: today_snaps="$('ls' -1 ${snap_prefix} 2>/dev/null |tr "\n" " " )" This one is so bad, I saved it for last. Ack! Pt! Wait, what? Why? What the? Huh?

Re: Syntax Question...

2011-08-16 Thread Linda Walsh
Dennis Williamson wrote: On Mon, Aug 15, 2011 at 10:19 PM, Linda Walsh wrote: How do I determine the location of my script? http://mywiki.wooledge.org/BashFAQ/028 ??? I don't understand the need for complexity -- what I have works. Its a few lines@ most -- I use the sa

Re: Syntax Question...

2011-08-16 Thread Linda Walsh
` Dennis Williamson wrote: Also, it's usually not necessary to maintain an index variable and use shift in a while loop. Use "for arg; do" which uses an implied $@. I tried to implement your suggestion and quickly ran into the reasons why I did what I did. Using the 'for x;

Re: Syntax Question...

2011-08-15 Thread Linda Walsh
` Dennis Williamson wrote: On Greg already covered some important points and I'll add a few more. *cough* sorry, I just haven't responded ... I threw up my hands in disgust and got too irritated to respond, so have done other things. As has been said before, d

Re: Syntax Question...

2011-08-15 Thread Linda Walsh
` Linda Walsh wrote: The latest error I got is a a simple type -- most of them probably are, with that many lines of code in ~3-4 weeks, there's bound to be -- trouble is I'm stubborn sometimes about 'punishing myself'' when I mess up...which isn't alway

Re: Syntax Question...

2011-08-14 Thread Linda Walsh
` Dennis Williamson wrote: http://mywiki.wooledge.org/XyProblem I suspect that you are hung up on the way to do something and have lost sight of (or failed to tell us) what it is you're *actually* trying to do. If what you're trying to do requires complex data structures, you're either doing

Re: Syntax Question...

2011-08-14 Thread Linda Walsh
` Dennis Williamson wrote: On Sun, Aug 14, 2011 at 6:31 PM, Linda Walsh wrote: please show quote the section that shows using an variable that holds the name of an array to be used (and assigned to) The FAQ covers indirect, it covers arrays, but I see no place where it covers

Re: Syntax Question...

2011-08-14 Thread Linda Walsh
Re: BashFAQ/006: http://mywiki.wooledge.org/BashFAQ/006 Pierre Gaston wrote: Linda: please show quote the section that shows using an variable that holds the name of an array to be used (and assigned to) else ... The proof is in the faq, you could have found it if you were n

Re: Syntax Question...

2011-08-14 Thread Linda Walsh
` Pierre Gaston wrote: On Sun, Aug 14, 2011 at 7:51 AM, Linda Walsh wrote: Dennis Williamson wrote: On Sat, Aug 13, 2011 at 6:41 PM, Linda Walsh wrote: I have to use 'indirect' syntax: � � ${!name} But that doesn't seem to play well with array syn

Re: Syntax Question...

2011-08-14 Thread Linda Walsh
` Michael Witten wrote: On Sun, Aug 14, 2011 at 04:55, Linda Walsh wrote: ` Michael Witten wrote: On Sat, Aug 13, 2011 at 23:41, Linda Walsh wrote: ${#${!name}[*]} bash: ${#${!name}[*]}: bad substitution It's probably what you're trying to avoid,

Re: Syntax Question...

2011-08-13 Thread Linda Walsh
` Michael Witten wrote: On Sat, Aug 13, 2011 at 23:41, Linda Walsh wrote: ${#${!name}[*]} bash: ${#${!name}[*]}: bad substitution It's probably what you're trying to avoid, but you'll probably have to construct and then eval the right code by hand: $(eval

Re: Syntax Question...

2011-08-13 Thread Linda Walsh
` Dennis Williamson wrote: On Sat, Aug 13, 2011 at 6:41 PM, Linda Walsh wrote: I have to use 'indirect' syntax: ${!name} But that doesn't seem to play well with array syntax: ${#${!name}[*]}# bash: ${#${!name}[*]}: bad substitution What syntax would

Syntax Question...

2011-08-13 Thread Linda Walsh
I want to have an array of 'names'. given a name, "X", I had a prefix, _p_, so have _p_X, I want to access / manipulate it as an array. so given I pass in a name in a var, I have to use 'indirect' syntax: ${!name} But that doesn't seem to play well with array syntax: ${#${!name}[*]} bash:

Re: Doc-bug Bash manpage:

2011-08-13 Thread Linda Walsh
Seems like this a bug in how 'groff' is configured to display various characters. Sorry the waste of space. Linda Walsh wrote: In my bash package: rpm -qi bash Name : bash Relocations: (not relocatable) Version : 4.1 Vendor: openSUSE Release : 20.25.1 Build Date: Sun 27 Feb

Re: set -e yet again (Re: saving bash....)

2011-08-12 Thread Linda Walsh
Greg Wooledge wrote: On Fri, Aug 12, 2011 at 12:19:59PM -0700, Linda Walsh wrote: Under -e, it would fail on the 'let' statement This is one of the cases I mention on http://mywiki.wooledge.org/BashFAQ/105 AND there, you explain WHY this needs to be fixed.

Doc-bug Bash manpage:

2011-08-12 Thread Linda Walsh
In my bash package: rpm -qi bash Name : bash Relocations: (not relocatable) Version : 4.1 Vendor: openSUSE Release : 20.25.1 Build Date: Sun 27 Feb 2011 05:51:30 AM PST Install Date: Sun 22 May 2011 01:28:49 PM PDT Build Host: build31 ... in the 'bash' manpage, under the 'set' option, under

Re: set -e yet again (Re: saving bash....)

2011-08-12 Thread Linda Walsh
Greg Wooledge wrote: On Fri, Aug 12, 2011 at 08:18:42AM -0700, Linda Walsh wrote: > If I write a==0 on the bash command line, it will generate an error. > > a=0 does not. 'Bash' knows the difference between an assignment and > a equality test in math. imadev:~$ ((a

Re: set -e yet again (Re: saving bash....)

2011-08-12 Thread Linda Walsh
Greg Wooledge wrote: On Thu, Aug 11, 2011 at 11:56:10PM -0700, Linda Walsh wrote: **Exception** declare -i a a=0 -- As a is declared to be an integer, it has the results evaluated at assignment time. a=0 is an integer expression that doesn't set $?=1 Neither should: ((a=0)) a

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 _

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 -

Re: saving bash.....

2011-08-10 Thread Linda Walsh
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. This is demonstrably false. --- No... you've only proven that you should have a bit of 'compassion' for

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

2011-08-10 Thread Linda Walsh
Chet Ramey wrote: Is this a fluke, due to the above changes NOT being 4.1? Or is this construction going to break in 4.2: '$((( )))' What does `break' mean? It's already written in a manner more confusing and obscure than necessary. What value do you think the extra set of p

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

2011-08-10 Thread Linda Walsh
Eric Blake wrote: On 08/10/2011 03:59 PM, Linda Walsh wrote: Is this a fluke, due to the above changes NOT being 4.1? Or is this construction going to break in 4.2: '$((( )))' According to POSIX, this construction should be parsed as an arithmetic substitution $(()) where the exp

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

2011-08-10 Thread Linda Walsh
Chet Ramey wrote: Yes. It's a case of not saving and restoring enough state across possibly- recursive calls to the shell parser. (The assignment statement is the key in this case.) > So, I compared subst.c files from bash-4.1-9 and bash-4.2-10 and was > able > to build a patch that it

Re: Another new 4.0 feature? functions can't return '1', (()) can't eval to 0?

2011-08-10 Thread Linda Walsh
This may be some 'cockpit error', but this is what I'm seeing right now and AFAICT, bash is broken. I have this statement: next line is line #300 have_dep -v base_mp_diff base_vg osnap_lv osnap_vg && { nextents="$(get_nextents_for_space_on_vg_w_minfree \

Re: Another new 4.0 feature? functions can't return '1', (()) can't eval to 0?

2011-08-09 Thread Linda Walsh
Chet Ramey wrote: On 8/9/11 8:10 PM, Linda Walsh wrote: The change to make (( honor the `errexit' option came in with bash-4.1, part of the cleanup after the Posix changes to the specification of the behavior of `set -e'. Most of the other changes in this area came in wit

Re: Coproc usage ... not understanding

2011-08-09 Thread Linda Walsh
Chet Ramey wrote: On 8/9/11 8:19 PM, Linda Walsh wrote: Linda Walsh wrote: I did think of that...but I thought when the foreground process closes 'input', then all of the chained utils should see 'eof', and should then flush their output...at least that was my belief

Re: Coproc usage ... not understanding

2011-08-09 Thread Linda Walsh
Bob Proulx wrote: Chet Ramey wrote: Linda Walsh wrote: Ideas? You're probably running into grep (and sort, and sed) buffering its output. I haven't been able to figure out a way past that. This may be a good point to mention this reference: http://www.pixelbeat.org/p

Re: Bug, or someone wanna explain to me why this is a POSIX feature?

2011-08-09 Thread Linda Walsh
Chet Ramey wrote:! It's not attempting command completion, since it doesn't think it's in a context where a command name is expected (the completion line parsing is pretty ad-hoc -- it doesn't use the shell parser). It's attempting readline's default filename completion. I'll have to see whethe

Re: Coproc usage ... not understanding

2011-08-09 Thread Linda Walsh
Linda Walsh wrote: I did think of that...but I thought when the foreground process closes 'input', then all of the chained utils should see 'eof', and should then flush their output...at least that was my belief in how they "should" be working...(sigh)... -

Re: Coproc usage ... not understanding

2011-08-09 Thread Linda Walsh
Chet Ramey wrote: What am I doing wrong? You're probably running into grep (and sort, and sed) buffering its output. I haven't been able to figure out a way past that. Chet --- I did think of that...but I thought when the foreground process closes 'input', then all of the chained ut

Re: Another new 4.0 feature? functions can't return '1', (()) can't eval to 0?

2011-08-09 Thread Linda Walsh
Chet Ramey wrote: On 8/8/11 11:43 PM, Linda Walsh wrote: I have a function that returns true/false. during development, (and sometimes thereafter depending on the script, I run with -eu, to make sure the script stops as soon as there is a problem (well, to 'try' to make sure, many

Another new 4.0 feature? functions can't return '1', (()) can't eval to 0?

2011-08-08 Thread Linda Walsh
I have a function that returns true/false. during development, (and sometimes thereafter depending on the script, I run with -eu, to make sure the script stops as soon as there is a problem (well, to 'try' to make sure, many are caught. But there are two instances that cause an error exit that s

Re: Bug, or someone wanna explain to me why this is a POSIX feature?

2011-08-08 Thread Linda Walsh
Michael Witten wrote: Reasonable? Or is someone going to tell me why blather is a desired and wanted feature (under one standard or another! ;-))... Reasonable, but naive. Interactive bash can complete variable names, even when they are quoted. --- That's cool! I'm talking about a

Re: manpage clarification/addition.

2011-08-08 Thread Linda Walsh
Roger wrote: On Mon, Aug 08, 2011 at 02:28:00PM -0700, Linda Walsh wrote: Lest some think functions can replace aliases, there's a line in the manpage that I feel needs amending. Currently it says: "For almost every purpose, aliases are superseded by shell functions." Whi

Re: bug: return doesn't accept negative numbers

2011-08-08 Thread Linda Walsh
Chet Ramey wrote: Sure. It's just removing the three lines of code that were added between bash-3.2 and bash-4.0. The question was always whether that's the right thing to do, and whether the result will behave as Posix requires. That explains why I never ran into this before!

Re: Bug, or someone wanna explain to me why this is a POSIX feature?

2011-08-08 Thread Linda Walsh
Michael Witten wrote: In any case, even if `no_empty_cmd_completion' were to behave as Linda expected, her tabs would still get eaten when pasted on the interactive command line. --- Which is what Linda expects... the function definition wouldn't hold spaces or tabs or whitespace unle

manpage clarification/addition.

2011-08-08 Thread Linda Walsh
Lest some think functions can replace aliases, there's a line in the manpage that I feel needs amending. Currently it says: "For almost every purpose, aliases are superseded by shell functions." While true, it may too likely be read by some to mean that aliases have no useful purpose. So I'

Re: bug: return doesn't accept negative numbers

2011-08-08 Thread Linda Walsh
Bob Proulx wrote: Linda Walsh wrote: Bob Proulx wrote: Exit codes should be in the range 0-255. --- I suppose you don't realize that 'should' is a subjective opinion that sometimes has little to do with objective reality. Sigh. Okay. Keep in mind that turn abo

Re: bug: return doesn't accept negative numbers

2011-08-08 Thread Linda Walsh
Eric Blake wrote: (exit -1); return That's not portable, either. exit is allowed to reject -1 as invalid. POSIX is clear that exit and return have the same constraints - if an argument is provided, it must be 0-255 to be portable. However, you are on to something - since bash allows 'exi

Re: Bug, or someone wanna explain to me why this is a POSIX feature?

2011-08-08 Thread Linda Walsh
Davide Brini wrote: foo() { # hit enter here # hit tab here Display all 112 possibilities? (y or n) The latter only attemps completion from names in the current directory. --- Right. That was my issue. My understanding is it shouldn't try to perform completion on an empty line.

Re: Bug, or someone wanna explain to me why this is a POSIX feature?

2011-08-08 Thread Linda Walsh
Michael Witten wrote: On Mon, Aug 8, 2011 at 18:44, Linda Walsh wrote: I was testing functions in my shell, I would cut/paste, thing is, with each past, I'd get my dir listed (sometimes multiple times) on each line entered. Now I have: shopt: no_empty_cmd_completion on i.e. it&

Bug, or someone wanna explain to me why this is a POSIX feature?

2011-08-08 Thread Linda Walsh
I was testing functions in my shell, I would cut/paste, thing is, with each past, I'd get my dir listed (sometimes multiple times) on each line entered. Now I have: shopt: no_empty_cmd_completion on i.e. it's not supposed to expand an empty line but type in function foo { return 1 } When

Re: bug: return doesn't accept negative numbers

2011-08-07 Thread Linda Walsh
Chet Ramey wrote: On 8/7/11 6:03 PM, Linda Walsh wrote: Bash itself is inconsistent in that it accepts exit values the same as every other program, but limits return values to a particular subset. Bash accepts any value you want to give to `return' and strips it to 8 bits, as the sta

Re: bug: return doesn't accept negative numbers

2011-08-07 Thread Linda Walsh
Bob Proulx wrote: Linda Walsh wrote: How about portable code using: (exit -1); return It's ugly, but would seem to be the portable/official way to do this. Exit codes should be in the range 0-255. --- I suppose you don't realize that &#x

Re: bug: return doesn't accept negative numbers

2011-08-07 Thread Linda Walsh
Eric Blake wrote: On 08/05/2011 05:41 PM, Linda Walsh wrote: Seem to fail on any negative number, but 'exit status' is defined as a short int -- not an unsigned value (i.e. -1 would return 255). In bash, 'return -- -1' sets $? to 255 (note the --). But since that is

Re: bug? {1..3} doesnt' use IFS to separate fields

2011-08-07 Thread Linda Walsh
Geir Hauge wrote: 2011/7/25 Linda Walsh I know it wasn't designed this way, but it seems like it is a bug. The manual says nothing about brace expansion using IFS in any way, so it's not a bug. I didn't say the manual said that. However, in expanding arra

"-i" doesn't seem to work when switching 'to' interactive and ignores or errors any attemps

2011-08-07 Thread Linda Walsh
I'm running shell script that will often run 'unattended' (batch), however, for testing and future flexablity, I wish to add an **option** (cmdline arg) to, after defining the utils of the lib, enter normal interactive mode, so the user could invoke the library calls from the cmdline, set or

Re: bug: return doesn't accept negative numbers

2011-08-05 Thread Linda Walsh
Linda Walsh wrote: Seem to fail on any negative number, but 'exit status' is defined as a short int -- not an unsigned value (i.e. -1 would return 255). Bob Proulx wrote: Eric Blake wrote: Linda Walsh wrote: I guess I don't use negative return codes that often in shell,

bug: return doesn't accept negative numbers

2011-08-05 Thread Linda Walsh
I guess I don't use negative return codes that often in shell, but I use them as exit codes reasonably often. 'return' barfs on "return -1"... Since return is defined to take no options, and ONLY an integer, as the return code, it shouldn't be hard to fix. Seem to fail on any negative number

Re: how to enable thread

2011-08-04 Thread Linda Walsh
a make -j will automatically try to schedule tasks on different cpu's if they are needed. Perhaps your job's weren't sufficiently long, or you didn't specify the makefile to be done in parallel. but try this: for i in {0..7};do (for ((j=0;j<10**6;++j)) {a=$j})& done That will run 8 loops of a

<    1   2   3   4   5   6   7   >