Re: completion gobbles partial match string

2010-05-05 Thread jidanni
CR> Should readline do this only if there are multiple matches? Getting over my head... I'll trust your judgment.

Re: Passing variables by reference conflicts with local

2010-05-05 Thread Freddy Vulto
Thanks, but I think I found a very nice, less complicated solution, and as I now understand from the investigation of the intricacies of `unset' elsewhere in this thread, it is perfect legitimate. A speed comparison between all different solutions/workarounds would be interesting though? My solut

Re: Support for /dev/unix

2010-05-05 Thread Norman Rasmussen
On Wed, May 5, 2010 at 2:32 PM, Chet Ramey wrote: > On 3/7/10 9:09 PM, Norman Rasmussen wrote: > > I find /dev/tcp terribly useful, is there any planned support for unix > > sockets? > > Not at this time. One can use named pipes; they're already addressable > using the file system. > Sure, I wa

Re: Passing variables by reference conflicts with local

2010-05-05 Thread Chet Ramey
On 5/4/10 1:57 PM, Freddy Vulto wrote: > It appears that `unset' is capable of traversing down the call-stack and > unsetting variables repeatedly: > > a=0 b=0 c=0 d=0 e=0 > _unset() { unset -v b c c d d d e; } > t1() { > local a=1 b=1 c=1 d=1 > t2 > } > t2() {

Re: Command substitution / word splitting question

2010-05-05 Thread Chet Ramey
On 4/23/10 4:17 AM, Binarus wrote: > The script > > echo 'line1' > file > echo 'line2' >> file > RESULT=$(cat file) > echo "$RESULT" > > gives the following output: > > line1 > line2 > > I don't understand why: the command substitution $(cat file) is not > within double quotes, so word splitti

Re: Crash on completion

2010-05-05 Thread Chet Ramey
On 3/9/10 7:52 AM, Knirch wrote: > Fix for above bug, would seem that the while loop has fallen out of > the globword: I posted a patch for this a while ago. Chet -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ``Ars longa, vita brevis'' - Hippocrates Chet Ramey,

Re: Support for /dev/unix

2010-05-05 Thread Chet Ramey
On 3/7/10 9:09 PM, Norman Rasmussen wrote: > I find /dev/tcp terribly useful, is there any planned support for unix > sockets? Not at this time. One can use named pipes; they're already addressable using the file system. Chet -- ``The lyf so short, the craft so long to lerne.'' - Chaucer

Re: string to integer

2010-05-05 Thread Greg Wooledge
On Fri, Apr 02, 2010 at 11:23:26AM -0700, DennisW wrote: > > > > On Mar 19, 12:39 pm, Javier Montoya wrote: > > > > > I have a several directories with *.jpg images. The image files are > > > > > named as ascending numbers and I would like to retrieve the lowest and > > > > > largest image number

Re: Passing variables by reference conflicts with local

2010-05-05 Thread Marc Herbert
>> Except that it forks a subshell and consumes trailing newlines, and >> the whole point of this exercise is to avoid forks and spurious >> corruption of trailing newlines. > > I will try to find an alternative to eval $( ) The code below allows the callee to return any kind of values (including

gmane gateway

2010-05-05 Thread Marc Herbert
Le 16/04/2010 09:09, pk a écrit : > it looks like the gateway between this > group and the mailing list hasn't worked for a long time. Is this intended? > Was it announced somewhere? Are you referring to the gmane group? If yes it has been working perfectly for me over the last few months.

Re: Passing variables by reference conflicts with local

2010-05-05 Thread Chet Ramey
On 5/3/10 3:30 PM, Freddy Vulto wrote: > On 100503 08:57, Chet Ramey wrote: >>> On Sat, May 01, 2010 at 04:26:16AM -0500, Dennis Williamson wrote: I prefer to avoid using eval by using declare, but declare inside a function makes the variable local. Wouldn't it be nice to have a glob

Re: Match newline character

2010-05-05 Thread Chet Ramey
On 4/3/10 2:33 PM, pk wrote: > Is the =~ operator supposed to recognize \n in patterns? No. "\n" matching a newline is not part of regular expression syntax. -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ``Ars longa, vita brevis'' - Hippocrates Chet Ramey, ITS

Re: Passing variables by reference conflicts with local

2010-05-05 Thread Chet Ramey
On 5/3/10 5:38 PM, Freddy Vulto wrote: > I think I found a much cleaner workaround. It looks like a called > function can really unset local variables in the caller(?!), This isn't surprising. A function could always unset variables at a higher scope; e.g., a function can unset a variable with

Command substitution / word splitting question

2010-05-05 Thread Binarus
Hi all, the bash reference manual states in chapter 3.5.7: "The shell scans the results of parameter expansion, command substitution, and arithmetic expansion that did not occur within double quotes for word splitting.". I thought I had understood this, but then came across a problem. Let's look

Re: string to integer

2010-05-05 Thread Javier Montoya
On Mar 19, 6:04 pm, DennisW wrote: > On Mar 19, 6:50 am, Javier Montoya wrote: > > > > > On Mar 19, 12:39 pm, Javier Montoya wrote: > > > > Dear all, > > > > I have a several directories with *.jpg images. The image files are > > > named as ascending numbers and I would like to retrieve the lowe

Re: string to integer

2010-05-05 Thread Javier Montoya
On Mar 19, 12:39 pm, Javier Montoya wrote: > Dear all, > > I have a several directories with *.jpg images. The image files are > named as ascending numbers and I would like to retrieve the lowest and > largest image number in each directory. An example of the content of a > directory is given belo

string to integer

2010-05-05 Thread Javier Montoya
Dear all, I have a several directories with *.jpg images. The image files are named as ascending numbers and I would like to retrieve the lowest and largest image number in each directory. An example of the content of a directory is given below: /bla/bla/bla/dir1 -> 0.jpg -> 1.jpg -> -> 09

Processing a file into smaller chunks

2010-05-05 Thread Javier Montoya
Dear all, I'm a newbie with bash programming and I'm trying to process a file into smaller chunks. Let's say I've to process the file below ('X' and 'Y' are any possible float number): 0 0 0 0 0 0 0 0 0 0 0 0 X X X X X 1.70 0 0 0 0 0 0 X X X X X 1.60 0 0 0 0 0 0 X X X X X 1.30 Y Y Y Y Y 1.90 0 0

Re: Crash on completion

2010-05-05 Thread Knirch
Fix for above bug, would seem that the while loop has fallen out of the globword: sections if (state == 0).. since I'm unsure what'll happen with my reply formatting etc the patch below is without whitespace changes, someone else can do a proper formatting of it :) kni...@traktor:/tmp/bash-4.1$ di

Support for /dev/unix

2010-05-05 Thread Norman Rasmussen
I find /dev/tcp terribly useful, is there any planned support for unix sockets? Perhaps /dev/unix/path/to/socket? (connects to named socket at /path/ to/socket)