Re: Bash bug with ints beyond 2147483646

2010-11-03 Thread Jan Schampera
Greg Wooledge wrote: On Tue, Nov 02, 2010 at 03:48:49PM -0400, Pete Gregory wrote: echo {2147483640..2147483647} dies with a malloc error In bash 4.1.9 under HP-UX 10.20, it consumes all available CPU until I kill it with SIGKILL. (I suppose there's a chance it might eventually have died due

Re: static vs. dynamic scoping

2010-11-09 Thread Jan Schampera
Eric Blake wrote: In static scoping, function f2 does not shadow a declaration of a, so references to $a within f2 refer to the global variable. The local variable a of f1 can only be accessed within f1; the behavior of f2 is the same no matter how it was reached. If it matters (I already kno

Re: Bug report

2010-11-11 Thread Jan Schampera
sworddrag...@aol.com wrote: Description: It is possible to make input with the keyboard before bash is fully initialized. This problem is critical on password inputs like the linux login. Repeat-By: $input is now shown before and after sworddra...@ubuntu:~$. Example: testsworddra...@u

Re: ionice bash pid in bash_profile Fails

2010-11-22 Thread Jan Schampera
Roger wrote: If you want the PID of the current shell process, use $$ instead. Yes I do. It's only me on this computer, unless you're speculating on prioritizing a snooper. :-O This is (in this context) not related to the number pf "bash" processes running. Not at all. -- Be conservative

Re: Referencing empty array with "set -u" active throws error

2010-12-18 Thread Jan Schampera
jens.schmid...@arcor.de wrote: For an empty "$@" this does not throw an "unbound" error, which seems to be an inconsistent behaviour to me. -u Treat unset variables as an error when substituting. I think the behaviour is consistent with the documentation. -- Be conservative in what you d

Re: quotes invade positional parameters

2010-12-18 Thread Jan Schampera
jida...@jidanni.org wrote: $ cat 201012contract #!/bin/sh -eux set a b c d e f : ''$@'' : ' '$@' ' : ''$*'' : '' $* '' : " "$* " " $ ./201012contract + set a b c d e f + : a b c d e f + : ' a' b c d e 'f ' + : 'a' b c d e 'f' + : '' a b c d e f '' + : ' a' b c

Re: nounset option does not work with array in arithmentic expressions

2010-12-18 Thread Jan Schampera
Joerg Boehmer wrote: The value of variable ar[1] is expanded to 0 although it was not set. The full syntax produces the expected behavior: The value of y is 0, since you operate in arithmetic context. This is fine. But I definitely agree it should bail out here. -- Be conservative in what y

Re: quotes invade positional parameters

2010-12-19 Thread Jan Schampera
jida...@jidanni.org wrote: Well anyway, it would be 'no skin off of bash's back' if it just reported what it was given. If it was given ' 'a b c it should report ' 'a b c and not just 'assume' we prefer ' a' b c or ' a' 'b' 'c' etc. Just as legitimate and doesn't cause calls in the middle

Re: Referencing empty array with "set -u" active throws error

2010-12-20 Thread Jan Schampera
jens.schmid...@arcor.de wrote: -u Treat unset variables as an error when substituting. I think the behaviour is consistent with the documentation. The question is rather when to consider a variable set or unset. I'm not sure about the intended meaning here, but I don't consiter $@ as a var

Word splitting and arithmetic expansion

2010-12-28 Thread Jan Schampera
Hello list, maybe something for old stagers. Bash (and POSIX, and Korn, ...) do field/word splitting on the result of arithmetic expansions. This is fine, the behaviour per se is not a problem at all. However, I wonder about the original thought behind it: Is there a specific reason or need

Re: Word splitting and arithmetic expansion

2010-12-29 Thread Jan Schampera
Chet Ramey wrote: Arithmetic expansion is a Posix invention. It's treated just like every other expansion: split unless double quoted. There's no compelling reason to make it behave differently. I don't want it to behave differently :) Okay, so it's just "as is", because by consistent desig

read builtin and readonly variables

2011-01-03 Thread Jan Schampera
Hello list, the read builtin command, when trying to assign to a readonly variable after reading the data, spits an error message. This is fine. But the return status is 0. It "always" (down to 2.04 was tested) has been like that, and it's like that in upcoming 4.2. For me, this doesn't ma

Huge execution time in 4.2, WAS: for; do; done regression ?

2011-01-07 Thread Jan Schampera
Alexander Tiurin wrote: ~$ time for i in `seq 0 1` ; do echo /o/23/4 | cut -d'/' -f2 ; done > /dev/null To track this a bit, I ran the exact command several times in a Bash 3.2, seeing increasing execution times (40s up to ~2min), as reported. I knew there were several bugs about filed

Re: Huge execution time in 4.2, WAS: for; do; done regression ?

2011-01-07 Thread Jan Schampera
Chet Ramey wrote: I can't imagine this is just some debugging code still active (it's a beta). Imagine. Anything that doesn't have a version tag of `release' has DEBUG enabled for the preprocessor, which enables MALLOC_DEBUG. If you're using the bash malloc, MALLOC_DEBUG turns on extensive m

'help set' missing '--'

2011-01-09 Thread Jan Schampera
Hello, the help output for the set builtin command misses '--'. The manpage is ok. (recognized by 'yitz' on irc://irc.freenode.net/#bash) -- Be conservative in what you do, be liberal in what you accept from others. - jbp, master of the net, in RFC793

Re: 'help set' missing '--'

2011-01-10 Thread Jan Schampera
Greg Wooledge wrote: Or: set [-abefhkmnptuvxBCHP] [-o option-name] [--] [arg ...] More: set [-abefhkmnptuvxBCHP] [-o option-name] [-] [--] [arg ...] Plus: Describe '--' the same way '-' is described (with an extra part in the full help message below the synopsis). -- Be conservative i

Re: 'help set' missing '--'

2011-01-10 Thread Jan Schampera
Dennis Williamson wrote: I think this distinction from the man page is what's missing in the help: > [...] Exactly. Thanks for pointing it out, I thought it was clear :) -- Be conservative in what you do, be liberal in what you accept from others. - jbp, master of the net, in RFC793

Re: for; do; done regression ?

2011-01-10 Thread Jan Schampera
Marc Herbert wrote: seq is not exactly Linux-only but GNU-only. GNU-specific versus bash-specific, which is worse? I'd say it depends... on which mailing-list you post :-) I'd say a script interpreted by the GNU shell must not rely blindly on GNU tools being installed or on running on a GNU

Here strings and pathname expansion

2011-02-13 Thread Jan Schampera
Hello world, I recently answered a question about using the asterisk mixed with redirection and other words. This also lead me to the documentation that states (REDIRECTION section): --- The word following the redirection operator in the following descriptions, unless otherwise noted,

Re: Here strings and pathname expansion

2011-02-14 Thread Jan Schampera
Roman Rakus wrote: It is noted in Here Documents (and Here Strings is a variant of here documents). And there is: No parameter expansion, command substitution, arithmetic expansion, or pathname expansion is performed on word. This is not true for here strings (infact, it wouldn't make sense

Re: Bash source repository

2011-05-31 Thread Jan Schampera
Bradley M. Kuhn wrote: I humbly suggest that http://git.savannah.gnu.org/cgit/bash.git be replaced with this repository above that I've created. The new repository contains everything that the current Savannah one does, but I put much more effort into making commits fine-grained, rather than me

Re: documentation bug re character range expressions

2011-06-02 Thread Jan Schampera
Hi, just as side note, not meant to touch the maintainer discussion. This is not only a "Bash problem". The programmer/user mistake to use [A-Z] for "only capital letters, capital A to capital Z" is a very common one. But I'm not sure if every official application-level documentation shoul

Re: Question about testing with variable operators

2011-06-10 Thread Jan Schampera
Andreas Schwab wrote: "Steven W. Orr" writes: As a work around, I can use eval or the builtin test, but my question is this: Is this a bug or is there a reason that it should work for arithmetic but not for the test [[ operator? [[ is a reserved word like if, which triggers special parsing r

Re: Permission denied to execute script that is world executable

2011-06-18 Thread Jan Schampera
John Williams wrote: I find that I cannot execute world-executable scripts when they are in a directory which is mounted on a drive on an HBA (host bus adapter Can you show the mount options of the filesystem? -- Be conservative in what you do, be liberal in what you accept from others. - jbp

Re: printf treats arguments of "%c" not as expected

2011-06-23 Thread Jan Schampera
Hi, I agree this is not a bug. %c works as described. However, Mr. Wang may want to read one of Greg's brilliant FAQ entries [1]. In general it's a bit of a pity that printf can do character->number conversion, but not (directly) back. But it is like it is and the "workarounds" are not reall

Re: printf treats arguments of "%c" not as expected

2011-06-23 Thread Jan Schampera
Yunfeng Wang wrote: Perhaps bash should clarify this issue in its documents such that users like me would not be misguided again. Since the reference to printf(3) is misleading sometimes, I made some document [1] for Bash's printf only. It's far from perfect, but at least it mentions %s and

Re: sorry--this is my question

2011-07-23 Thread Jan Schampera
On 22.07.2011 18:12, the mad doctor kaeding wrote: is this a bug? echo goodbye\ cruel\ world\! goodbye cruel world! echo "goodbye cruel world!" bash: !": event not found echo "goodbye cruel world\!" goodbye cruel world\! No, this is a specific history expansion in interactive shells. E

Massive recursion -> SEGV

2012-07-01 Thread Jan Schampera
Hi folks, a suggestion about recursive function calls (and not only that, of course). Do you see a way for Bash to pull the emergency break before it runs out of stack here (to provide an error to the user, rather than a crash): f1() { f1 } f1 Cu

Re: Massive recursion -> SEGV

2012-07-01 Thread Jan Schampera
On 01.07.2012 14:37, Roman Rakus wrote: Look for FUNCNEST variable. In recent release it is available. I more meant the shell interpreter, less the code I can write. -- Be conservative in what you do, be liberal in what you accept from others. - jbp, master of the net, in RFC793

Re: Massive recursion -> SEGV

2012-07-02 Thread Jan Schampera
On 02.07.2012 15:57, Eric Blake wrote: Look for FUNCNEST variable. In recent release it is available. I more meant the shell interpreter, less the code I can write. It would be possible to link bash with libsigsegv to install a graceful stack overflow handler that allows a nicer exit message

Re: Massive recursion -> SEGV

2012-07-02 Thread Jan Schampera
On 02.07.2012 20:57, Chet Ramey wrote: On 7/2/12 2:36 PM, Jan Schampera wrote: The origin of this all was a "bugreport" to me about the manual lying about no limits on recursion That's funny. Aye. A bit of confusion. -- Be conservative in what you do, be liberal in what

Re: Undocumented behaviour - parameter expansion ${par-word}

2012-09-04 Thread Jan Schampera
On 04.09.2012 13:13, Roman Rakus wrote: Hi, Petr, adding to cc: list, found behaviour not documented, neither in man page nor bash ref manual: ${par-word} will do expansion of par, and if the par is unset it is substituted by word. It is different from ${par:-word}, where word is used when par is

Suggestion: Documentation: ulimit -f

2006-03-23 Thread Jan Schampera
Hi folks. Currently, the documentation (both, help-command and manpage) on ulimit -f says: "The maximum size of files created by the shell" which may make one think of, it only affects files that are created from the shell itself. Assuming -f works like it should work, a text like: "The maxi

Arithmetic expressions and parameters with newlines breaks

2007-07-02 Thread Jan Schampera
Configuration Information [Automatically generated, do not change]: Machine: i486 OS: linux-gnu Compiler: gcc Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='i486' -DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='i486-pc-linux-gnu' -DCONF_VENDOR='pc' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash

Fw: Arithmetic expressions and parameters with newlines breaks

2007-07-02 Thread Jan Schampera
Begin forwarded message: Date: Mon, 2 Jul 2007 18:32:49 +0200 From: Jan Schampera <[EMAIL PROTECTED]> To: [EMAIL PROTECTED] (Bob Proulx) Subject: Re: Arithmetic expressions and parameters with newlines breaks On Mon, 2 Jul 2007 10:08:08 -0600 [EMAIL PROTECTED] (Bob Proulx) wrote:

Re: "bashbug" script

2007-08-04 Thread Jan Schampera
On Thu, 2 Aug 2007 09:29:19 -0400 Chet Ramey <[EMAIL PROTECTED]> wrote: > > Here was an interesting bug which was some what unexpected. > > > > cat <(find ./ -iname t{1,2,3}) > > > > this is a valid command according to bash due to a bugged expansion > > of {1,2,3} and the process expansion. It

Re: time builtin handles backgrounding poorly

2007-09-12 Thread Jan Schampera
Jack Lloyd wrote: Description: The time builtin seems to be confused if something is backgrounded, and prints immediately the time rather than waiting for the job to complete. I found this very unexpected. Repeat-By: $ time sleep 5 # hit C-Z to stop the job before 5 se

Re: Web urls cannot be accessed from Bash Terminal

2007-09-17 Thread Jan Schampera
Pratiksha Powar wrote: Description: Yum not able to access url through bash Repeat-By: Following is the sequence of commands and the results: 1. [EMAIL PROTECTED] /]# yum install gcc 2. Loading "installonlyn" plugin 3. Setting up Install Process 4. Setti

Re: Missing character when using ${VAR:1} and length(VAR)==1

2007-09-20 Thread Jan Schampera
Chet Ramey wrote: Description: there is missing a charachter when using the following: # TT="oo"; echo "l${TT:1}l" lol # TT="o"; echo "l${TT:1}l" l I can't reproduce this; I get `ll' from the second expansion. I can't reproduce it on a 2.05b: $ TT="o

Re: Linux: bash 'declare -f' adds trailing whitespaces to output

2007-09-25 Thread Jan Schampera
Jari Aalto wrote: testfunc () $ { $ echo "this is test"$ }$ Just a thought: It looks like there is a system behind it. So I guess it's some parser thing that needs it like that. However, just guessing. Jan

Re: using NUL in scripts

2007-09-26 Thread Jan Schampera
Mike Frysinger schrieb: > is it even possible to utilize NUL in scripts ? or does bash just strip it > out ? for example, trying to work with binary data: > foo=$( echo "${foo}" > new-file > the "new-file" will be exactly "binary-file" if all NUL bytes are stripped out > > or perhaps i want to

Re: bash -n doesn't seem to catch all syntax errors...

2007-10-15 Thread Jan Schampera
Ken Failbus wrote: > When I specify on command-line "bash -n ". Bash doesn't > check for valid syntax errors. E.g. if variable is missing a "$" infront > of it while assigning a value. This is not catched by bash. > ### example code > p=hello > e=world > If [ p != $e ];then > echo "not equa

Re: Can't unset function with unusual names

2007-10-16 Thread Jan Schampera
Andreas Schwab wrote: >> $ unset .foo-bar >> bash: unset: `.foo-bar': not a valid identifier > > Use unset -f. IMHO there is a bug. The docs say that ''unset'' without a specific switch affects variables AND functions, hence it should allow the names for both (or it should ONLY affect

Re: Looping through lines with tabs of file with cat

2007-11-04 Thread Jan Schampera
yitzle wrote: > fileIn="blah" > for i in "$(cat $fileIn)" > do > echo $i > echo > done Check out http://wooledge.org/mywiki/BashFAQ#faq1 J.

[BUG?] read -n limits bytes, not characters

2007-11-13 Thread Jan Schampera
Configuration Information [Automatically generated, do not change]: Machine: i486 OS: linux-gnu Compiler: gcc Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='i486' -DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='i486-pc-linux-gnu' -DCONF_VENDOR='pc' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash

Re: Tilde expandion for values of long options

2007-12-08 Thread Jan Schampera
Per Starbäck wrote: > Repeat-By: > echo foo=~root => foo=/root > echo --foo=~root=> --foo=~root > > In the second one there is no expansion. >From my understanding of the manpage and the SUS the first one is "wrong", it should not be expanded. I don't say it's

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: bash does not jump where it is supposed to jump

2008-01-19 Thread Jan Schampera
William Tambe wrote: > The code below should only print end > [ "test" = "test" ] && { > # after the false command bash should jump directly to echo end > # but instead run echo echo "test != test" > false > } || { > echo "test != test" > } > > echo end It's okay like that, it's

Re: Comparison failure

2008-01-19 Thread Jan Schampera
Chet Ramey wrote: > Dave Rutherford wrote: > >> Now, "[[" isn't very well documented, so I tend not to use it, > > I'm always interested in suggestions for improving the bash documentation. > Can you tell me what's unclear about the existing description of > `[['? > > Chet > The documentation

Re: Sub-arrays do not work with non-blank IFS

2008-01-29 Thread Jan Schampera
Lea Wiemann wrote: > Repeat-By: > > IFS=$'\n' > a=(A B C D) > b=("[EMAIL PROTECTED]") > echo "[EMAIL PROTECTED]", "[EMAIL PROTECTED]" # 4, A B C D -- OK > b=("[EMAIL PROTECTED]:2}") > echo "[EMAIL PROTECTED]", "[EMAIL PROTECTED]" # 1, C D -- bug, should be 2, > C D I have to correct myself, i

Re: Sub-arrays do not work with non-blank IFS

2008-01-29 Thread Jan Schampera
Lea Wiemann wrote: > Configuration Information [Automatically generated, do not change]: > Machine: i486 > OS: linux-gnu > Compiler: gcc > Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='i486' > -DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='i486-pc-linux-gnu' > -DCONF_VENDOR='pc' -DLOCALEDIR='/

Re: `read' builtin does not take last record without trailing delimiter

2008-02-26 Thread Jan Schampera
Scott Mcdermott wrote: > Bash does not seem to take the last record if it has no > trailing delimiter: > > > $ echo "0 1 2^3 4 5^6 7 8" | > while read -a array -d ^ > do echo $array > done > 0 3 > This behavior is counter-intuitive. It just throws away the > last line

Re: Possible eval builtin speedup?

2008-03-06 Thread Jan Schampera
Nicolas Bonifas wrote: >> > I don't know much about bash internals, but there is probably room for >> > a huge performance improvement in speeding up the eval builtin. >> > What do you think about it? Would it be a difficult task? >> >> It is more likely to be the command substitution that i

Re: Possible eval builtin speedup?

2008-03-07 Thread Jan Schampera
Nicolas Bonifas wrote: > Thanks for your answer. > >> I assume you know that the speed issues most likely come from the >> operating system's supporting functions like the fork() and exec*() >> family members? > > How does it explain the speed difference between "echo `dircolors`" > and "dircol

Re: style of assignment to variable changes command selection

2008-03-08 Thread Jan Schampera
Bob Proulx wrote: > This implies to me that a variable assignment forces subsequent > commands to be external commands because the current environment is > not affected. In your case above the external /usr/bin/time program > is forced by the variable assignment requiring the environment > variab

Re: would you give me a hand with a simple 'if' bash script?

2008-03-13 Thread Jan Schampera
hawa wrote: > Execuse me, would you give me a hand with a simple 'if' bash script? > I want to make folders "00", "01",...,"20" and > copy existing files file_00, file_01,,file_20 to each folder. > Thank you very much. > > > > - > for (( i = 1 ; i <= 20;

Re: Fwd: Problem with bash completion

2008-03-15 Thread Jan Schampera
Chris F.A. Johnson wrote: >> bash-3.2$ ./x/ < tab after x now adds slash >> >> Once the shell starts doing this, it keeps doing it. Restarting bash >> solves the problem. > >I don't see that problem, and I'm using the same version of >bash. I can reproduce it, s

Re: problems with 'read'ing from a pipe

2008-03-15 Thread Jan Schampera
John Smith wrote: > Ok, so maybe I should have just 'read the manual' > ;) > > But it still confuses me somewhat, since AT&T's kornshell behaves > differently.. I just downloaded the latest available version for Linux > from the url mentioned below, and it does work in AT&T's ksh as I > expected..

Re: problems with output redirection

2008-04-02 Thread Jan Schampera
Verena Alishahi wrote: > My first script (local.sh) reads a list of worksation cluster clients > from hosts.inp in a loop and prints some output to output.txt. In the > loop a second script (remote.sh) is called in a ssh instruction. > remote.sh then writes some output to the same output.txt file,

Re: read builtin function keeps trailing white space

2008-04-09 Thread Jan Schampera
Eduardo Sanz Garcia wrote: > Description:* >read builtin function keeps trailing white space when the default > variable REPLY is used. >This is specially bad when using the -e option because readline puts > and extra space after pressing a the tab key to autocomplete a word. >The IFS

Re: function names which contain a 'dash' character

2008-05-09 Thread Jan Schampera
Stephane Chazelas wrote: > Note that bash didn't have to. POSIX allows a shell to accept > any character in a function name, but it says one shouldn't use > those in a POSIX script, which is different. I'm not a POSIX expert, and this is the SUS, but I read: | The format of a function definitio

Re: function names which contain a 'dash' character

2008-05-09 Thread Jan Schampera
Paul Jarc wrote: >> | The function is named fname; the application shall ensure that it is a >> | name (see the Base Definitions volume of IEEE Std 1003.1-2001, Section >> | 3.230, Name). > > "The application" is the script, not the shell, so this is consistent > with Stephane's statement. Ok, g

Re: unexpected behavior of 'read' builtin

2008-05-24 Thread Jan Schampera
Juliano F. Ravasi wrote: > The second one is that it chops leading and trailing whitespace > when you provide one variable for assignment, and not when you > use the default $REPLY. > > I don't know if these are intended behavior, but it doesn't seem > to be documented, leadin

Function definition syntax inconsistencies

2008-06-04 Thread Jan Schampera
Configuration Information [Automatically generated, do not change]: Machine: i486 OS: linux-gnu Compiler: gcc Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='i486' -DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='i486-pc-linux-gnu' -DCONF_VENDOR='pc' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash

Re: Function definition syntax inconsistencies

2008-06-05 Thread Jan Schampera
Thanks for your replies. I didn't want to raise a portability and POSIX discussion. I know about that. I was referring to either a bug in the Bash manual or a bug in the Bash code, nothing else. Let's try to rephrase that a bit (the topic is not POSIX nor portability): The Bash manual allows the

Re: range match works incorrect

2008-06-05 Thread Jan Schampera
Roman Rakus wrote: > I think in range [a-d] shouldn't be any upper char. These are 2 > different things. Collate orders and range match. Try to use glob and > you will see difference. > This is really not good behavior of bash. This is and always has been locale-dependent. The collation sequence

Re: range match works incorrect

2008-06-05 Thread Jan Schampera
Roman Rakus wrote: > sequence, inclusive. In other locales, a range expression has > unspecified behavior: strictly conforming applications shall not rely on > whether the range expression is valid, or on the set of collating > elements matched. A range expression shall be expressed as the startin

Re: Function definition syntax inconsistencies

2008-06-13 Thread Jan Schampera
Chet Ramey wrote: >> - >> $ function name (echo) >> bash: syntax error near unexpected token `echo' >> - > It's not. It's a shift/reduce conflict in the grammar. The default > yacc/bison behavior is to choose the `function word () command'

Re: Bash/readline enhancement: wish to pre-set initial value of input text

2008-07-07 Thread Jan Schampera
Richard Neill wrote: > Dear All, > > When using read, it would be really neat to be able to pre-fill the form > with a default (or previous) value. > > For example, a script which wants you to enter your name, and thinks > that my name is Richard, but that I might want to correct it. > Alternativ

Re: Bash substrings: wish for support for negative length (read till n from end)

2008-07-07 Thread Jan Schampera
Richard Neill wrote: > $ echo ${stringZ:2: -1} #Wish: start at 2, read till > ERROR #1 before the end. i.e. > # cde > > $ echo ${stringZ: -3: -1} #Wish: start 3 back, read till > ERROR #1 before the en

Re: Bash substrings: wish for support for negative length (read till n from end)

2008-07-07 Thread Jan Schampera
Jan Schampera wrote: > Richard Neill wrote: > >> $ echo ${stringZ:2: -1} #Wish: start at 2, read till >> ERROR#1 before the end. i.e. >> # cde >> >> $ echo ${stringZ: -3: -1}#Wi

Re: function name bug ?

2008-07-31 Thread Jan Schampera
christophe malvasio wrote: cbz (){ echo "why 'cbz' not a valid function name ?";} bash: syntax error near unexpected token `(' It works for me. What does "alias cbz" say for you? alias work He wants to know if you probably have an alias named "cbz" defined, not if your alias engine works.

Re: set -x output of test operator is irretating

2008-07-31 Thread Jan Schampera
Bob Proulx wrote: Chet Ramey wrote: Toralf Förster wrote: I'm wondering why in the example (see below) the right side is prefixed with a '\' wheras the left side is unchanged. ... [EMAIL PROTECTED] ~ $ echo "1 2 3 4" | while read a b c d; do [[ "$a" = "$b" || "$a"

Re: set -x output of test operator is irretating

2008-07-31 Thread Jan Schampera
Jan Schampera wrote: = and == should make have difference in behaviour. "should not show differences" *suh* Sorry J.

Re: Last modified files with owner / time / permissions

2008-09-10 Thread Jan Schampera
lexton wrote: From what I read it is not good to use ls -la in the manner I use below. Could I run this by just using the find command with additional arguments? I still need to be able to print everything that the ls -la command gives me GNU find has an -ls option IIRC, which produces output

Re: Bash prints syntax error when command in $(...) contains case-esac

2008-09-30 Thread Jan Schampera
Juergen Gohlke wrote: Description: If a command in $(...) contains a case-esac construction, the bash prints a syntax error instead of executing the code: bash: syntax error near unexpected token `;;' In case you have trouble with code you need, use this workaround: x=$

Re: feature request: "wait --free-slot" for poor man's parallelization

2008-10-03 Thread Jan Schampera
Mike Coleman wrote: Here's a bash feature I'd love to see, but don't have time to implement myself: a "--free-slot" flag to 'wait' that will wait until there is at least one free "slot" available, where a slot is basically a CPU core. Example usage: $ for ((n=0; n<100; n++)); do my_experi

Development snapshot

2008-10-14 Thread Jan Schampera
Hello, is there something like a development snapshot for Bash 4 or is the code "hidden" during development phase and I need to wait for the first release? Thanks in advance, Jan -- This is my life - this is my net! - Jan

Re: Question on bash clearwildcards

2008-11-22 Thread Jan Schampera
grendelos wrote: > So this is really bugging me. Why is [a-z] not case sensitive, but [A-Z] is? > For example: > > # ls -l > total 0 > -rw-r--r-- 1 root root 0 Nov 20 12:22 xa > -rw-r--r-- 1 root root 0 Nov 20 12:22 xA > > # ls -l x[a-z] > -rw-r--r-- 1 root root 0 Nov 20 12:22 xa > -rw-r--r-- 1

Re: [bash-testers] Re: case modification operators misbehaviour?

2009-01-14 Thread Jan Schampera
Chet Ramey wrote: >> The case modification operators (for parameter expansion) seem to be >> puzzled. >> >> Two things I don't understand: >> - it seems to work word-wise (might be due to my misinterpretion of the >> default pattern) > > It does work word-by-word, like the emacs-mode editing comm

Bash 4: command_not_found_handle event handler

2009-01-16 Thread Jan Schampera
Hello list! Just a few thoughts, awaiting comments. Currently, Bash 4 calls a fixed named function command_not_found_handle() when a command is not found. The basic approach (to have such a possibility) is great, but: I can imagine that there may be more internal events to react on in future. IM

Re: simple bug/compat question

2009-01-19 Thread Jan Schampera
Linda Walsh wrote: > Am running an older bash version and this may be fixed (assuming it > is a bug and I'm not confused...:-)) > > bash version = 3.2.39(20) > > This works: > 1)if [ -n "" -a 2 -gt 1 ] ; then echo one;fi > > This does not: > 2)if [[ -n "" -a 2 -gt 1 ]] ; then echo on

Re: Bash 4: command_not_found_handle event handler

2009-01-20 Thread Jan Schampera
Jan Schampera wrote: > Hello list! > > Just a few thoughts, awaiting comments. Heh. I wanted to raise a discussion about that issue, but it seems I failed (or I'm the only one who cares) ;) Jan

The colon

2009-01-26 Thread Jan Schampera
Hi. In comp.unix.shell [1] somebody wondered about IFS=: read a b <<< a:b; echo "'$a' '$b'" ending up in 'a b' '' Korn and Z seem to behave different. I see that across all my available Bash versions. I remember the colon to be special in some way (was it hostnames in a file path?), but I don

Re: The colon

2009-01-27 Thread Jan Schampera
Stephane Chazelas wrote: >> If this is intended behaviour, can you tell me why (it's gone with >> quoting/escaping, of course)? > [...] > > That would be a bug. Looking at the code, it takes a different Good to know that I'm not completely mistaken - it smells buggy. Only Chet knows for sure wh

Re: if, -n

2009-02-01 Thread Jan Schampera
coubeatczech wrote: > c...@notas:~$ if [ -z $variable ]; then echo true; fi > true > c...@notas:~$ > > Can anybody explain to me this behaviour? I would expect not any output in > the last command...? The variable is set to zero and there is the condition > is still true...? http://bash-hackers.

Re: Bash with colors?

2009-02-15 Thread Jan Schampera
tal396 wrote: > there is any way to echo "aaa" or any msg in colors? Start at http://bash-hackers.org/wiki/doku.php/scripting/terminalcodes and continue at whatever Google spits out for: - bash colors - terminal colors - ANSI colors - VT100 colors J.

Re: Help: Bash script that show you the last file created?

2009-02-15 Thread Jan Schampera
Mike Frysinger wrote: >> there is any way to get the last file that created that is fomat is *.sql > why not just use `ls` and one of its sort options ? the ls man page > documents > how to sort by creation time > -mike Without looking there: It can't be documented, because there's no gener

Re: Help: Bash script that show you the last file created?

2009-02-15 Thread Jan Schampera
Mike Frysinger wrote: >> Without looking there: It can't be documented, because there's no >> general way to retrieve the creation time of a file. > > the op wasnt asking for the time, they were asking for the last created file. > > and the ls man page talks how to sort by ctime. Yes, that's

Re: Bash with colors?

2009-02-15 Thread Jan Schampera
Antonio Macchi wrote: > commands like "ls --color" does not use terminfo capabilities... > > ...use instead fixed strings (without regards about TERMinal) > is this a good (and safe) choice too? IMHO not. Too many assumptions. GNU ls seems to always assume an ANSI terminal, regardless which TER

Re: Bash with colors?

2009-02-16 Thread Jan Schampera
Antonio Macchi wrote: >>> commands like "ls --color" does not use terminfo capabilities... >> >>> ...use instead fixed strings (without regards about TERMinal) >>> is this a good (and safe) choice too? >> >> IMHO not. Too many assumptions. GNU ls seems to always assume an ANSI >> terminal, regardle

Re: coproc command doesn't accept NAME arg

2009-02-24 Thread Jan Schampera
Tim Hatch wrote: > Pilot:~/tmp/bash-4.0 tim$ coproc NAME ls > [1] 18474 > Pilot:~/tmp/bash-4.0 tim$ ./bash: line 32: NAME: command not found > > [1]+ Exit 127coproc COPROC NAME ls For some reason it expects a compound command on named coprocesses, http://bash-ha

Re: large exit values (>255)

2009-02-25 Thread Jan Schampera
Mike Frysinger wrote: > $ true > $ echo ' > > $ echo $? > 258 > > $ true > $ echo ' > > $ echo ' > > $ echo $? > 386 > > that doesnt seem right to me :) > > the first test seems fine, and older versions of bash would set 258 for the > second test (not sure if it's correct though), but the t

Re: large exit values (>255)

2009-02-25 Thread Jan Schampera
Mike Frysinger wrote: > $ true > $ echo ' > > $ echo $? > 258 > > $ true > $ echo ' > > $ echo ' > > $ echo $? > 386 Just tested it, hopefully it's as easy as changing every itos (last_command_exit_value) to itos (last_command_exit_value & 0xFF) in subst.c (seems 2 times). I don't provid

Re: arguments to script prefixed with "--" in debug

2009-02-27 Thread Jan Schampera
lehe wrote: > Hi, > I am trying to debug my shell script by bashdb. My script take as argument > "--gdb", so I wrote > bashdb myscript.sh --gdb > However, this way it will produce error that bashdb: > unrecognized option '--gdb' > > If I quote --gdb as > bashdb myscript.sh '--gdb' > th

Re: reference dir ../common in script

2009-03-05 Thread Jan Schampera
OnTheEdge wrote: > I'm trying to check for a directory and create it if it doesn't exist as > follows: > > CommonDir="../common" > if [ -d ${CommonDir} ]; then >mkdir "${CommonDir}" > fi > > It works from the command line, but my script doesn't seem to like it and I > can't figure it out. >

Re: Feature Idea: Enhanced Tab Completion

2009-03-21 Thread Jan Schampera
Cam Cope wrote: > Combine tab completion with history: when you put ! at the beginning of a > command and use tab completion, it displays history results IMHO yet a new history expansion/editing/searching mechanism (there already are a few) would bloat it even more. But that's just my opinion. J

Re: contents of whole arrays dissapears leaving while read loop

2009-03-26 Thread Jan Schampera
Lennart Schultz wrote: > In the construct > cat file|while read line > do > done > the content of any arry assignments in the loop dissapears leaving the loop: This is logic, since every part of the pipe runs in an own subshell (the first one runs in the "current shell"). This behaviour is also *

Re: [bash-bug] contents of whole arrays dissapears leaving while read loop

2009-03-26 Thread Jan Schampera
Dr. Werner Fink wrote: >> This is not a bug, this is a consequence of Bash's design. > > Yep ... nevertheless a side mark: ksh can do ;) Which is: A consequence of Korn's design ;-) *waves the 80km to Nuremberg* Jan

Re: arithmetic + > + subshell might not be documented

2009-04-01 Thread Jan Schampera
jida...@jidanni.org wrote: > Might not be documented: > > $ cat q > for i in : :; do :|: > x$((++a)); echo =$a=; done; ls x?; rm x? > for i in : :; do : > x$((++b)); echo =$b=; done; ls x?; rm x? > $ bash q > == > == > x1 > =1= > =2= > x1 x2 > > I don't think it's specific to arithmetics. I

  1   2   >