Re: Negative indexes in ${arr[@]:off:length}

2011-06-29 Thread Mart Frauenlob
On 29.06.2011 18:31, Maarten Billemont wrote: On 29 Jun 2011, at 14:05, Mart Frauenlob wrote: On 29.06.2011 13:42, Maarten Billemont wrote: On 27 Jun 2011, at 16:25, Chet Ramey wrote: [...] Exactly, let's draw the array in the example: arr=(a b c) values: [ a | b | c ] indexes:

Re: Negative indexes in ${arr[@]:off:length}

2011-06-29 Thread Mart Frauenlob
On 29.06.2011 13:42, Maarten Billemont wrote: On 27 Jun 2011, at 16:25, Chet Ramey wrote: [...] Exactly, let's draw the array in the example: arr=(a b c) values: [ a | b | c ] indexes: 0 1 2 3 [...] 4 members? $ arr=(a b c) $ for x in 0 1 2 3; do printf "<%s>\n" "${arr[x]}"; done

Re: When double quote is considered when not?

2011-03-30 Thread Mart Frauenlob
On 30.03.2011 14:09, Mart Frauenlob wrote: [...] so the test command sees 'word2' while it expects another operator. sorry, i meant to write 'word1'

Re: When double quote is considered when not?

2011-03-30 Thread Mart Frauenlob
On 30.03.2011 12:13, ali hagigat wrote: The following scripts were run for /bin/bash, version 4.0.33, and then comes their outputs. In the second example seems to have a warning: "binary operator expected". Why the error is generated? and why there is no error for the first example? -

Re: bizarre trap behavior while reading a file

2011-03-28 Thread Mart Frauenlob
On 28.03.2011 18:03, tytus64 wrote: [...] trap "" HUP; cat $log_file | { while read line [...] useless use of cat! while read ... < file no need for a subshell actually (introducted by the pipe).

Re: help builtin bug ???

2011-01-19 Thread Mart Frauenlob
On 20.01.2011 01:22, Sławomir Iwanek wrote: hello, I did something like that: $ help * and I got all the definitions of builtins starting from the letter 'c' that is from 'caller' through 'coproc'. Well, my goal was - as you probably happen to know it already ;) - to see if I could display AL

Re: how to escape single quote?

2010-12-28 Thread Mart Frauenlob
On 29.12.2010 08:28, ali hagigat wrote: I wonder if anybody knows how to escape a single quote character by /bin/sh or bash? echo 'ppp\'qqq'' ppp\qqq Please look at the above example and the result. Regards from man bash: Enclosing characters in single quotes preserves the literal valu

Re: Indirect expansion and arrays

2010-12-09 Thread Mart Frauenlob
On 29.07.2010 22:55, Bernd Eggink wrote: It seems that indirect expansion doesn't work with arrays: $ a=(x y z) $ b=a $ echo "${!b[0]} ${!b[1]} ${!b[2]}" x Is that intended? The documentation isn't explicit about it. IMHO it would be very desirable to have a indirect expansion facility for arr

Re: Variable getopts lost

2010-02-23 Thread Mart Frauenlob
On 23.02.2010 20:55, Daniel Bunzendahl wrote: > Am Dienstag, 23. Februar 2010 20:45:31 schrieb Greg Wooledge: >> On Tue, Feb 23, 2010 at 08:30:16PM +0100, Daniel Bunzendahl wrote: >>> if [ !$LSEITE ]; then >> >> You want: if [ ! "$LSEITE" ] > > this dosn't work. > > But I earsed the if-loop. And

Re: Variable getopts lost

2010-02-23 Thread Mart Frauenlob
On 23.02.2010 00:14, DanielBu wrote: > > Hello all, > > I get crazy with getopts: > Some Times my script (500 Lines) don't take input parameters like this: > > /bin/bash pdf2media.sh -f 9 -l 104 Document.pdf > > the script reads -f 9 and Documents.pdf but missing -l 104 > > It did work for a l

Re: FWD: About Bash Script

2010-02-16 Thread Mart Frauenlob
On 16.02.2010 19:52, Curtis wrote: > Thanks pk! > > That's the same thin Greg told me. > > #!/bin/bash > > > if [! -e b.txt]; if [[ ! -e b.txt ]; then ...; fi or if [[ ! - b.txt ]] then ... fi you only need the semicolon if you omit the newline. > > then > > mv a.txt b.txt > > exit > >

FWD: About Bash Script

2010-02-15 Thread Mart Frauenlob
> Original Message > Subject: About Bash Script > Date: Mon, 15 Feb 2010 10:39:25 -0600 > From: Curt > To: mart.frauen...@chello.at > Hi Mart- > > I saw you were helping another guy with a bash scripthopefully you'll > remember but i'm trying to modif

Re: variable assignment in string returning function

2010-01-27 Thread Mart Frauenlob
On 27.01.2010 13:49, Sharuzzaman Ahmat Raslan wrote: > Hi, > > I found the behaviour of the function below is a little bit odd. Appreciate > if someone can share his/her knowledge regarding the behaviour. > > The output of the script will be: > > sharuzza...@debian:~$ ./case1.sh > Nice behaviour

Re: Argument list too long (how to remove the limit)

2010-01-25 Thread Mart Frauenlob
On 26.01.2010 01:03, Peng Yu wrote: > I got the following message. Is there a way to configure bash such > that there is not a limit like this? > > /bin/bash: Argument list too long > > http://www.linuxjournal.com/article/6060 best regards Mart

Re: building arrays from non array variables using 'array[${#arr...@]}]='

2010-01-25 Thread Mart Frauenlob
On 24.01.2010 21:19, Chet Ramey wrote: > On 1/24/10 5:13 AM, Mart Frauenlob wrote: >> Hello, >> >> I'd like to ask, if the behavior of indexed array assignment using the >> form: 'array[${#arr...@]}]=' is as expected. > > Thanks for the report.

building arrays from non array variables using 'array[${#arr...@]}]='

2010-01-24 Thread Mart Frauenlob
Hello, I'd like to ask, if the behavior of indexed array assignment using the form: 'array[${#arr...@]}]=' is as expected. I tested bash versions 3.1.17 and 4.0.35. Using v3.1 an explicitly declared non array variable (global or local) results in an empty array[0] entry. Using v4.0 the explicitly

big 'list' consumes all memory

2009-04-16 Thread Mart Frauenlob
Hello, today while playing around with brace expansion, I ran into something for me unexpected. The actual intension was to compare the speed / system usage of `seq x y' and brace expansion {x..y}. So I took a fairly large integer (lets say 15755500), and ran the following: seq 0 15755500 -

Re: how to pass arguments with space inside?

2009-04-10 Thread Mart Frauenlob
Stephane CHAZELAS wrote: 2009-04-09, 23:18(+02), Mart Frauenlob: [...] I wonder where's the bug report? You seem to miss that the support place for bash is 'gnu.bash' not 'gnu.bash.bug'. [...] Interesting, I can see that Google groups has a gnu.bash newsgroup with m

Re: how to pass arguments with space inside?

2009-04-10 Thread Mart Frauenlob
lehe wrote: Hi, I was wondering how to pass arguments with space inside. For example, my bash script looks like: #!/bin/bash ARG_OPTS="" while [[ -n "$1" ]]; ARG_OPTS="${ARG_OPTS} $1" shift done If I pass an argument like "--options='-t 0 -v 0'", then it would be splitted by the spa