what is wrong here?

2012-03-28 Thread Francky Leyn
Hello, consider the following code: EXTENSION=jpg INPUT_FILES=*.$EXTENSION if [ -z "$INPUT_FILES" ]; then echo "No .$EXTENSION input files in this directory" exit -1 fi Consider a dir with some .jpg files. the if close is not executed. This is correct. Consider now a dir without .jpg file

strange behavior of assignment

2012-03-28 Thread Francky Leyn
Hello, consider the following snippet: EXTENSION=png INPUT_FILES=*.$EXTENSION If there are for example 3 input files, an echo delivers: echo $INPUT_FILES --> '01.png 02.png 03.png' No we change the EXTENSION: EXTENSION=jpg Now, in a dir without jpg files the following happens: INPUT_FILES=

Re: what is wrong here?

2012-03-28 Thread mhenn
Am 08.08.2011 11:33, schrieb Francky Leyn: > Hello, > > consider the following code: > > EXTENSION=jpg > INPUT_FILES=*.$EXTENSION echo "$INPUT_FILES" #obviously wrong #instead maybe INPUT_FILES="$(ls *.$EXTENSION)" > > if [ -z "$INPUT_FILES" ]; then > echo "No .$EXTENSION input files in this

Re: what is wrong here?

2012-03-28 Thread mhenn
Am 08.08.2011 14:17, schrieb mhenn: > Am 08.08.2011 11:33, schrieb Francky Leyn: >>[...] > > echo "$INPUT_FILES" #obviously wrong > #instead maybe > INPUT_FILES="$(ls *.$EXTENSION)" > >> [...] That actually wasn't such a good advice: Better use find or or

Re: what is wrong here?

2012-03-28 Thread Francky Leyn
On 8/8/2011 2:17 PM, mhenn wrote: Am 08.08.2011 11:33, schrieb Francky Leyn: Hello, consider the following code: EXTENSION=jpg INPUT_FILES=*.$EXTENSION echo "$INPUT_FILES" #obviously wrong #instead maybe INPUT_FILES="$(ls *.$EXTENSION)" I tried something similar: INPUT_FILES=`ls *.$EXTENS

Re: what is wrong here?

2012-03-28 Thread mhenn
Am 08.08.2011 15:22, schrieb Francky Leyn: > On 8/8/2011 2:17 PM, mhenn wrote: >> Am 08.08.2011 11:33, schrieb Francky Leyn: >>> Hello, >>> >>> consider the following code: >>> >>> EXTENSION=jpg >>> INPUT_FILES=*.$EXTENSION >> >> echo "$INPUT_FILES" #obviously wrong >> #instead maybe >> INPUT_FILES

sed problem

2012-03-28 Thread Francky Leyn
Hello, I have the following problem: I must write a sed script that converts parts of groff syntax to LaTeX syntax. eg: .BI -o gif_output_file -> \textbf{-o} \textit{gif\_output\_file} Lets neglect the underscores for the moment. This can be dan with s/\.BI \([^ ]*\) \([^ ]*\)/\\textbf{\1} \\

Re: initialisation bash variables

2012-03-28 Thread Patrick
On 17.08.2011 20:53, Stephane CHAZELAS wrote: 2011-08-17, 08:32(+02), Francky Leyn: On 8/16/2011 10:53 PM, Stephane CHAZELAS wrote: 2) If VAR coincides with an environment variable, and in the script I change it value, is this then propagated to outside the script? Is the environment v

I/O bug with big file?

2012-03-28 Thread Erwan
Hi all, Here is a small test which shows what happens: limit=5; x=1; while [ $x -le $limit ]; do printf "%010d\n" $x; x=$(( $x + 1)); done >bigfile.txt while read line; do echo -e "TEST\t$line"; done >bug.txt Basically the first line creates a big 5Gb text file containing 500 millions nu

Behavior of calling return from a trap

2012-03-28 Thread dave reisner
Hi all, I'm noticing some odd behavior in an ERR trap with errtrace. It's present in bash 3.2 and as well as 4.2. The simplest reproduction is as follows: --8<-- #!/bin/bash somefunc() { false echo "shouldn't see this" } set -E trap -- 'return 1' ERR somefunc echo "

Re: Pathname expansion not performed in Here Documents

2012-03-28 Thread Davide Baldini
On 02/27/12 04:11, Dan Douglas wrote: > "If word is unquoted, all lines of the here-document are subjected to > parameter expansion, command substitution, and arithmetic expansion." > > No pathname expansion. That section of manual doesn't specifically include word splitting nor pathname expans

incompatibility in regex

2012-03-28 Thread Peter Schreiber
Hi, have experienced the following: 3.1.17(1)-release: -> [[ a =~ a|b ]] && echo true -bash: syntax error in conditional expression: unexpected token `|' -> [[ a =~ a\|b ]] && echo true # that one works in version 3 true === 4

Re: Edit vs delete a running script. Why difference?

2012-03-28 Thread David Thomas
On Jan 18, 5:22 am, Greg Wooledge wrote: > On Wed, Jan 18, 2012 at 01:19:20PM +0900, Teika Kazura wrote: > > If the > > entire script is read at invocation, then why should / does > > modification affect? Is it a bug? > > The entire script *isn't* read at invocation.  Bash just reads a little > bi

Re: what is wrong here?

2012-03-28 Thread Greg Wooledge
On Mon, Aug 08, 2011 at 03:41:52PM +0200, mhenn wrote: > Am 08.08.2011 15:22, schrieb Francky Leyn: > > On 8/8/2011 2:17 PM, mhenn wrote: > >> Am 08.08.2011 11:33, schrieb Francky Leyn: > >>> consider the following code: > >>> > >>> EXTENSION=jpg > >>> INPUT_FILES=*.$EXTENSION > >> > >> echo "$INPU

initialisation bash variables

2012-03-28 Thread Francky Leyn
Hello, if you have a variable, say VAR, and you don't assign it a value, and afterwards you test it, what is the value of $VAR then? random, or an empty string? Best regards, Francky

Re: shopt can't set extglob in a sub-shell?

2012-03-28 Thread Davide Baldini
On 02/26/12 12:41, John Kearney wrote: > I updated that wiki page > Hopefully its clearer now. > http://mywiki.wooledge.org/glob#extglob Valuable information. I wonder if some of it should be included in the user manual, at least to point out some possible misbehaviours one wouldn't expect.

Re: Syntax Question...

2012-03-28 Thread Patrick
On 18.08.2011 12:44, Stephane CHAZELAS wrote: 2011-08-17, 08:24(-04), Greg Wooledge: 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 term

Writing to bash's tty too fast: workarounds?

2012-03-28 Thread George
I'm the maintainer of a terminal emulator on Mac OS and a user reported that if he pastes a large string of the form: cat << EOF > whatever.txt blah blah blah blah blah blah ... etc for 100k ... EOF That the output is badly mangled. I can reproduce this consistently with a smallish test program.

Re: incompatibility in regex

2012-03-28 Thread Greg Wooledge
On Mon, Oct 10, 2011 at 08:06:17PM +0200, Peter Schreiber wrote: > 3.1.17(1)-release: > > -> [[ a =~ a|b ]] && echo true > -bash: syntax error in conditional expression: unexpected token `|' > > -> [[ a =~ a\|b ]] && echo true # that one works in version 3 > true > > ==

print function in /examples/functions/kshenv

2012-03-28 Thread Paul Tibbitts
This is not a bug in bash itself, but I was wondering if there are any updates to the ksh-compatibility print function provided with bash in the source distribution (in the examples/functions/kshenv file), specifically with regards to ksh-compatible handling of -R. Using ksh: $ print -R -z -z Us

Re: {varname} for redirection does not work with arrays

2012-03-28 Thread Bash M'head
On Nov 5, 12:34 pm, Stephane CHAZELAS wrote: > 2011-11-2, 12:01(-06), unkn...@vmw-les.eng.vmware.com: > [...]> Description: > >    If {varname} is an assoc. array in a redirection the exec will fail > >    The [] should not be confused with pathname expansion just like ${}. > > > Repeat-By: > >  

Syntax coloring/highlighting in gnu-readline

2012-03-28 Thread LanX
Hi >From my understanding of >http://cnswww.cns.cwru.edu/php/chet/readline/rltop.html it's OK to ask gnu-readline questions in this list. I'm trying to interactively add colors while typing in readline and using rl_event_hook to change rl_line_buffer seems to work. Alas the ANSI escape codes f

Re: how to write this in bash

2012-03-28 Thread mhenn
Am 05.08.2011 17:47, schrieb Maverick: > I also tried already > > $CMD || echo 'Error...' && exit -1 see man bash | less -p Compound $CMD || { echo 'Error...'; exit -1; }

Re: excess braces ignored: bug or feature ?

2012-03-28 Thread Davide Baldini
On 02/17/12 20:51, Mike Frysinger wrote: > FOO= BAR=bar > : ${FOO:=${BAR} > echo $FOO Why should this be a bug? Your second line performs a parameter expansion, all the remaining characters are joint into the token and passed to ':'. No bug.

Re: initialisation bash variables

2012-03-28 Thread Francky Leyn
On 8/15/2011 9:24 PM, Stephane CHAZELAS wrote: 2011-08-15, 17:15(+02), Francky Leyn: Hello, if you have a variable, say VAR, and you don't assign it a value, and afterwards you test it, what is the value of $VAR then? random, or an empty string? [...] Upon startup, the shell makes one shell

Re: bash-4.2, crosscompiling and job control compile failure

2012-03-28 Thread bigbigboy
On Sep 15, 9:20 am, Chet Ramey wrote: > On 9/14/11 4:57 PM, Maciej Grela wrote: > > > In which tarball will your fix be released ? I don't understand the > > code flow between the tarballs and git on savannah, the git repo > > contains only imports from tarballs until 4.0, and the newest tarball >

Please... No Racing with the Planes

2012-03-28 Thread Myra Perry
'Philadelphia International Airport shut down temporarily Thursday morning after a civilian drove onto the runway.'... More on story here[http://tothecenter.com/2012/03/philadelphia-airport-shut-down-for- car-on-the-runway/].

Re: String behaviour

2012-03-28 Thread Michael Witten
On Fri, Jun 24, 2011 at 10:38, BX wrote: > #/bin/bash > # file1 > import() > { >   source file2 > } > > import > > echo v1=$v1, v2=$v2, v3=$v3 > > #/bin/bash > # file2 > v1=v1 > declare -x v2=v2 > declare v3=v3 > > Run above script by > $ bash file1 > > Expected result: v1=v1, v2=v2, v3=v3 > Real

Re: bash-4.2, crosscompiling and job control compile failure

2012-03-28 Thread Chet Ramey
On 9/16/11 12:35 PM, bigbigboy wrote: > On Sep 15, 9:20 am, Chet Ramey wrote: >> On 9/14/11 4:57 PM, Maciej Grela wrote: >> >>> In which tarball will your fix be released ? I don't understand the >>> code flow between the tarballs and git on savannah, the git repo >>> contains only imports from ta

Re: print function in /examples/functions/kshenv

2012-03-28 Thread Chet Ramey
On 8/20/11 11:17 PM, Paul Tibbitts wrote: > This is not a bug in bash itself, but I was wondering if there are any > updates to the ksh-compatibility print function provided with bash in > the source distribution (in the examples/functions/kshenv file), > specifically with regards to ksh-compatible

Re: Bug fix for $((x**y)) algorithm on 64+ bits machines.

2012-03-28 Thread Chet Ramey
On 9/19/11 2:35 PM, Stephane CHAZELAS wrote: > FYI, ksh93 uses pow(3). So does zsh, but only in floating point > mode. > > Probably better and more efficient than reinventing the wheel. Maybe, but since bash doesn't use floating point arithmetic, probably not. -- ``The lyf so short, the craft

Re: COMP_POINT is not set correctly when there is non-ascii characters in the command line.

2012-03-28 Thread Chet Ramey
On 3/27/12 2:17 PM, Yichao Yu wrote: > So is it possible to set COMP_POINT as the number of characters > between 0 and rl_point (if it is also bad to break libreadline api by > setting rl_point as that.) without screwing up other part of the code? > (I hope this fix would be no more than searching

Re: COMP_POINT is not set correctly when there is non-ascii characters in the command line.

2012-03-28 Thread Yichao Yu
On Wed, Mar 28, 2012 at 10:48 PM, Chet Ramey wrote: > On 3/27/12 2:17 PM, Yichao Yu wrote: >> So is it possible to set COMP_POINT as the number of characters >> between 0 and rl_point (if it is also bad to break libreadline api by >> setting rl_point as that.) without screwing up other part of the