Re: Inconsistent results when history -s is used within PROMPT_COMMAND

2009-06-12 Thread DennisW
Wow, that got really mangled somewhere! Here's the main part of the test script again. Hopefully it'll come through OK this time. histt() { local space='' space="${1:+ }" # set space to a space of there's a $1 local hist local comment hist=$(history 1) hist="${hist# *[0-9]* }"

Re: <( error

2009-11-28 Thread DennisW
On Nov 28, 8:44 am, Jan Schampera wrote: > Antonio Macchi schrieb: > > > $ hd <(echo -en \\0{0..3}{0..7}{0..7}) > > > it breaks the console. > > It doesn't "break the console", it crashes the shell (here with a > subshell to get the text): > > bon...@core:~$ bash > bon...@core:~$ hd <(echo -en \\0

Re: Use of pipe in $(< filename | program) returns null

2009-11-28 Thread DennisW
On Nov 28, 4:46 am, Andreas Schwab wrote: > Bernd Eggink writes: > > Am 28.11.2009 06:35, schrieb r...@saturn.syslang.net: > > >> Description: > >>        use of $(<  filename | program) does not work. It either should or > >> it should be properly documented. > >>        The problem also happen

Re: PROMPT_DIRTRIM skips depth n-1 when ~ is n

2009-11-28 Thread DennisW
On Nov 28, 5:25 am, "dennis" wrote: > Configuration Information [Automatically generated, do not change]:Machine: > i486OS: linux-gnuCompiler: gccCompilation CFLAGS:  -DPROGRAM='bash' > -DCONF_HOSTTYPE='i486' -DCONF_OSTYPE='lin$uname output: Linux emperor > 2.6.31-14-generic #48-Ubuntu SMP Fri Oct

Re: Array parameter expansion with non-space-IFS on bash-3/4

2009-11-29 Thread DennisW
On Nov 27, 3:47 pm, Freddy Vulto wrote: > I noticed different behaviour between bash-3 and bash-4 when > performing parameter expansion on an array with IFS set to a non-space > value.  For example, on bash-3.2.39, I get: > >     $ bash -c 'IFS=:; printf "<%s>\n" "${@/q}"' x a b >     > > Whereas

Re: output redirection with process substitution asynchronous?

2009-12-04 Thread DennisW
On Dec 4, 9:28 am, pjodrr wrote: > Hello, > > how can I prefix every line of output of some command with a > timestamp?  I thought like this: > > $ exec 3> >(while read line; do echo "$(date): $line"; done) > $ seq 4 >&3 > Friday, December  4, 2009  4:20:29 PM MET: 1 > $ Friday, December  4, 2009

Re: output redirection with process substitution asynchronous?

2009-12-04 Thread DennisW
On Dec 4, 12:58 pm, pk wrote: > pjodrr wrote: > > Hello, > > > how can I prefix every line of output of some command with a > > timestamp?  I thought like this: > > > $ exec 3> >(while read line; do echo "$(date): $line"; done) > > $ seq 4 >&3 > > Friday, December  4, 2009  4:20:29 PM MET: 1 > > $

Re: functions can be created with dotted name but not removed

2009-12-04 Thread DennisW
On Dec 4, 9:25 am, "Michael O'Donnell" 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' > -DC

Re: output redirection with process substitution asynchronous?

2009-12-05 Thread DennisW
On Dec 5, 3:14 am, pjodrr wrote: > Hello, > > On Dec 4, 8:18 pm, DennisW wrote: > > > It works for me. Does it not for you? If you're asking why not do it, > > then the answer is "why call an external program unnecessarily?". > > > Sorry, by the

Re: output redirection with process substitution asynchronous?

2009-12-07 Thread DennisW
On Dec 7, 10:25 am, Marc Herbert wrote: > Marc Herbert wrote: > > What is wrong with the following: > > > prefix_with_date () > > { > >     while read; do > >         printf '%s: %s\n' "$(date)" "$REPLY"; > >     done > > } > > > seq 4 | prefix_with_date > > ls | prefix_with_date > > Sorry I misse

Re: Fullscreen & unchecking show menubar.

2009-12-07 Thread DennisW
On Dec 6, 9:39 pm, Rodney Varney III wrote: > From: rodne...@gmail.com > To: bug-b...@gnu.org,b...@packages.debian.org > Subject: Full screen and unchecking show menubar > > Configuration Information [Automatically generated, do not change]: > Machine: x86_64 > OS: linux-gnu > Compiler: gcc > Comp

Re: bash is not capable of comparing of strings and real numbers

2009-12-07 Thread DennisW
On Dec 7, 4:22 pm, pk wrote: > phani krishna jampala wrote: > > bash is not capable of comparing of strings ( imean interms of lessthan or > > greater than etc) > > It is, if you use [[  ]] > > a="abcd" > b="bcde" > if [[ "$b" > "$a" ]]; then >   echo "$b is greater than $a" > fi > > > and real nu

Re: bash is not capable of comparing of strings and real numbers

2009-12-08 Thread DennisW
On Dec 8, 7:11 am, Greg Wooledge wrote: > On Mon, Dec 07, 2009 at 05:08:02PM -0800, DennisW wrote: > > Since printf understands floats (or acts like it does), you can use it > > plus a little care and luck to do float comparisons in Bash: > > [...] > > $ printf -v a &q

Re: Error on meta-{ filename expansion

2009-12-09 Thread DennisW
On Dec 9, 10:05 am, Jeff Terrell wrote: > (pasted this in from dead.bashbug when the mail failed.) > > Configuration Information [Automatically generated, do not change]: > Machine: i486 > OS: linux-gnu > Compiler: gcc > Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='i486' - > DCONF_OSTYPE

Re: Error on meta-{ filename expansion

2009-12-09 Thread DennisW
On Dec 9, 10:05 am, Jeff Terrell wrote: > (pasted this in from dead.bashbug when the mail failed.) > > Configuration Information [Automatically generated, do not change]: > Machine: i486 > OS: linux-gnu > Compiler: gcc > Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='i486' - > DCONF_OSTYPE

Re: add a way to declare global variables

2009-12-12 Thread DennisW
On Dec 12, 4:24 am, Bernd Eggink wrote: > Am 12.12.2009 02:11, schrieb Matthew Woehlke: > > > konsolebox wrote: > >> I hope the development team will also consider adding a way in bash to > >> declare global variables inside a function perhaps either with an > >> option in typeset or declare like

Re: compgen -f failing on directory containing single quote

2009-12-13 Thread DennisW
On Dec 13, 4:07 am, Freddy Vulto wrote: > `compgen -f' produces no output if the directory contains a single quote. > I get the same result on both bash-3.2.39 and bash-4.0.35. > > Steps to reproduce the problem: > >     $ mkdir a\'b >     $ touch a\'b/{c,d} >     $ compgen -f a\'b/ >     $ > > Ex

Re: compgen -f failing on directory containing single quote

2009-12-13 Thread DennisW
On Dec 13, 8:17 am, Freddy Vulto wrote: > On 091213 05:13, DennisW wrote: > > > However, with quoting, these work: > > > compgen -f "a\'b/" > > compgen -f 'a\"b/' > > > or using a variable: > > > dir="a\'b/

Re: want a M-. that ignores C-r

2009-12-18 Thread DennisW
On Dec 18, 10:17 am, jida...@jidanni.org wrote: > Same question for years: > Want some way for M-. to get the last item, regardless of if we are here > via a C-r or not. I want some dumber-downed version of M-., however at > the same time I don't want to use that cshell ! stuff. I want something >

Re: Query regarding ${parameter:-word} usage

2009-12-23 Thread DennisW
On Dec 23, 6:51 pm, Mun wrote: > Hi, > > I am moving from ksh93 to bash and have a question regarding the usage > of ${parameter:-word} parameter expansion. > > In ksh, I use ${*:-.} as an argument to commands.  For example: > >    function ll >    { >       ls --color -Flv ${*:-.} >    } > > This

Re: ERR trap inheritance in command substitution

2010-01-10 Thread DennisW
On Jan 8, 11:50 am, Stefan Götz wrote: > Hi! > > It seems that in bash version 4.0.33(1)-release (i486-pc-linux-gnu) (from > Ubuntu > 9.04), ERR traps are not inherited by functions that are called via command > substitution. I expected inheritance to apply in this case since the > documentation

Re: Problems when RANDOM without $ is used as an array index

2010-01-11 Thread DennisW
On Jan 11, 3:53 pm, Stephane CHAZELAS wrote: > 2010-01-11, 15:59(-05), Chet Ramey: > [...]> Think of it as > > > x = $(( RANDOM%6+1 + RANDOM%6+1 )) > > y = dice[x] > > dice[RANDOM%6+1 + RANDOM%6+1] = y + 1 > > return y > > [...] > > I would still consider that a bug. > > I don't think anyone would

Re: history position out of range

2010-01-13 Thread DennisW
On Jan 13, 2:29 pm, Sérgio Monteiro Basto wrote: > Hi, > How I delete history from entry 2 to entry 22 > > $ history -d 2:22 > bash: history: 2:22: history position out of range > > man history say: > > history -d offset > > where is define, the sintax of the offset? > > Thanks in advance, > -- >

Re: history position out of range

2010-01-15 Thread DennisW
On Jan 14, 2:11 pm, Sergio Monteiro Basto wrote: > Hi, > How I delete history from entry 2 to entry 22 > > $ history -d 2:22 > bash: history: 2:22: history position out of range > > man history say: > > history -d offset > > where is define, the sintax of the offset? > > Thanks in advance, > -- >

Re: possible bug on readline

2010-01-18 Thread DennisW
On Jan 17, 11:40 pm, Samus_ wrote: > to reproduce simply try to glob-expand the following code: "$(" * You can reproduce that without the asterisk. I doubt that that's a bug in readline. The errors you're getting are from tab-completion which is done in a script. It's not handling the quotes pro

Re: possible bug on readline

2010-01-18 Thread DennisW
On Jan 18, 11:01 am, Chet Ramey wrote: > On 1/18/10 12:40 AM, Samus_ wrote: > > > hello,  I had this on my shell: fgrep "$(nl_join " templates/ > > advertiser/campaign* and when tried to perform readline's glob-expand- > > word I got some parse errors, I'm not sure if it is a bug or the > > expect

Re: Problems when RANDOM without $ is used as an array index

2010-01-20 Thread DennisW
On Jan 20, 7:28 am, Stephane CHAZELAS wrote: > 2010-01-12 22:07:31 -0500, Chet Ramey: > > > > > On 1/12/10 5:16 AM, Stephane CHAZELAS wrote: > > > 2010-01-11, 17:42(-05), Chet Ramey: > > Think of it as > > > x = $(( RANDOM%6+1 + RANDOM%6+1 )) > > y = dice[x] > > dice[RANDOM%6+1

Re: Selecting out of an array

2010-01-25 Thread DennisW
On Jan 25, 7:28 pm, Jon_R wrote: > Hello List, > > I am new to shell scripting and programming in general, so please excuse my > ignorance. :) > > I am trying to setup a menu for some videos that I have so that you can > select one and it will play it using xine or mplayer. My first attempt was >

Re: variable assignment in string returning function

2010-01-27 Thread DennisW
On Jan 27, 10:54 am, "Chris F.A. Johnson" wrote: > On Wed, 27 Jan 2010, Sharuzzaman Ahmat Raslan wrote: > > 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: > > >

Re: Sort: problem with option -f

2010-01-28 Thread DennisW
On Jan 28, 8:43 am, Guido Milanese wrote: > I am facing a problem concerning SORT on a Linux Ubuntu 9.04 > distribution. > I noticed that the -f option seems not to work. This is an example: > DOG > CAT > zebra > dog > ZEBRA > mouse > > Running "sort" on the file I get: > CAT > dog > DOG > mouse >

Re: Bash sometimes cannot find aliases

2010-01-28 Thread DennisW
On Jan 28, 2:55 am, Dan Zwell wrote: > Configuration Information [Automatically generated, do not change]: > Machine: x86_64 > OS: linux-gnu > Compiler: gcc > Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='x86_64' > -DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='x86_64-unknown-linux-gnu' > -DC

Re: command not put into history if it starts with space

2010-02-05 Thread DennisW
On Feb 5, 4:07 am, Paul Stansell wrote: > Configuration Information [Automatically generated, do not change]: > Machine: i386 > OS: linux-gnu > Compiler: gcc > Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='i386' > -DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='i386-redhat-linux-gnu' > -DCONF_

Re: Passing variables to and from custom programs

2010-02-06 Thread DennisW
On Feb 6, 5:37 pm, djackn wrote: > May I used the following in a bash script to pass variables to myIpExec? > >     Result = myIpExec(${IPaddr1} ${IPaddr2} ${IPaddr3} ${IPaddr4}) > > myIpExec is a c program that normally uses scanf to prompt the user > for the IP addresses and returns 0 or 1. > I

Re: Bug with -o posix, local variables and assignment preceding builtins

2010-02-07 Thread DennisW
On Feb 7, 7:33 pm, Crestez Dan Leonard wrote: > We encountered a strange bug while working on bash-completion. I was > originally only able to reproduce this through a fairly elaborate setup > but Freddy Vulto found a tiny test case: > >     set -o posix >     t() { >         local x >         BA

Re: + vs. [^/]* - Regular Expression bug?

2010-02-09 Thread DennisW
On Feb 8, 11:38 pm, Morten Lauritsen Khodabocus wrote: > Hello, > > Ran into some particular behaviour with REs in bash, I just cannot > understand how this could possibly be correct behaviour. Then again, I > am no bash guru, could very well be me missing a clue. > > If I am wasting your time, si

Re: Circulate matches in command completion?

2010-02-11 Thread DennisW
On Feb 11, 11:33 am, Peng Yu wrote: > On Thu, Feb 11, 2010 at 10:36 AM, Chet Ramey wrote: > > On 2/11/10 11:05 AM, Peng Yu wrote: > >> On Thu, Feb 11, 2010 at 9:58 AM, Chet Ramey wrote: > >>> On 2/11/10 10:54 AM, Peng Yu wrote: > Suppose I file 'a1.txt' and 'a2.txt' in my current directory.

Re: declare -c still undocumented.

2010-02-12 Thread DennisW
On Feb 12, 2:10 am, Mikael Fridh wrote: > Configuration Information [Automatically generated, do not change]: > Machine: x86_64 > OS: linux-gnu > Compiler: gcc > Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='x86_64' > -DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='x86_64-pc-linux-gnu' > -DCON

Re: Confused about how bash breaks input into words

2010-02-23 Thread DennisW
On Feb 23, 8:41 pm, Allen Halsey wrote: > Eric Blake redhat.com> writes: > > > > > But you missed that: > > > $(date +'%Y-%m-%d') > > > is an entire word (basically, an unquoted $ character consumes until the > > end of the shell substitution, command substitution, or arithmetic > > substitution,

Re: Why tab is not colored?

2010-05-04 Thread DennisW
On Mar 7, 10:20 am, Peng Yu wrote: > My grep is aliased to "grep --color=auto". > > I then use grep "", where is a tab character. But the > result is not colored. How to make the tabs colored? If you grep for a space or a newline, they don't get highlighted either. That's just the way it works.

Re: string to integer

2010-05-04 Thread DennisW
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 lowest and > > largest image number in each dire

Re: string to integer

2010-05-04 Thread DennisW
On Apr 2, 8:19 am, Javier Montoya wrote: > 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

Mapfile callback access to current line

2010-05-04 Thread DennisW
Mapfile would be that much more powerful if the callback function had access to the current line. Is there any chance this might be added in the future?