Re: Passing variables by reference conflicts with local

2010-05-01 Thread Dennis Williamson
As Chet said, use internal variables that are unlikely to conflict. # Param: $1 variable name to return value to blackbox() { local __bb_a# internal: __, blackbox: bb, a: _a eval $1=bar } f() { local a blackbox a echo $a } f# no conflict I

Re: Passing variables by reference conflicts with local

2010-05-01 Thread Dennis Williamson
be as simple as that. Thanks, Pierre, by the way, for the workarounds. I hadn't considered using indirection that way. On Sat, May 1, 2010 at 6:21 AM, Freddy Vulto fvu...@gmail.com wrote: On 100501 12:40, Pierre Gaston wrote: On Sat, May 1, 2010 at 12:26 PM, Dennis Williamson wrote: As Chet said, use

Re: Passing variables by reference conflicts with local

2010-05-01 Thread Dennis Williamson
In Bash 3.2.0(1)-release, local displays local variables that do and do not have values. In Bash 4.0.33(1)-release and 4.1.0(1)-release only those with values are printed. Oops. f () { local var1 var2=abc var3=; local; }; f Bash 3: var1= var2=abc var3= Bash 4: var2=abc var3= So it looks like

Re: Passing variables by reference conflicts with local

2010-05-02 Thread Dennis Williamson
I would discourage the use of l (ell) as a variable name for readability. I like the fact that _blackbox_called_by uses a parameter rather than parsing the caller's name. This allows you to permit multiple callers to a common private function, if needed. However, I'm assuming that you will name

Re: Bash interprets $! as an event

2010-07-29 Thread Dennis Williamson
History expansion is performed before variable expansion. From man bash: History expansion is performed immediately after a complete line is read, before the shell breaks it into words. and ! Start a history substitution, except when ***followed by a blank***, newline, carriage

Re: Indirect expansion and arrays

2010-07-29 Thread Dennis Williamson
To make your example work try: $ b=a[*] or $ b...@] Otherwise, your indirection is telling b to look at a as a scalar. This would give the same result: $ echo $a x On Thu, Jul 29, 2010 at 3:55 PM, Bernd Eggink mono...@sudrala.de wrote: It seems that indirect expansion doesn't work with

Re: Indirect expansion and arrays

2010-07-29 Thread Dennis Williamson
Oops, sorry, that converts all of a to a scalar b so ${b[0]} gives x y z and ${b[1]} gives nothing. On Thu, Jul 29, 2010 at 7:16 PM, Dennis Williamson dennistwilliam...@gmail.com wrote: To make your example work try: $ b=a[*] or $ b...@] Otherwise, your indirection is telling b to look

Re: weird behaviour of ((count++)) when using , , to change to lower case

2010-08-01 Thread Dennis Williamson
If I do the echo line twice, I get a segfault in both Bash 4.0.33(1)-release and 4.1.0(1)-release. And you're right about being evaluated twice. On Sun, Aug 1, 2010 at 3:59 PM, Bernd Eggink mono...@sudrala.de wrote: Am 01.08.2010 13:06, schrieb Andrew Benton: Also good. Now try converting it

Re: RFE -or- Howto?

2010-08-02 Thread Dennis Williamson
It's called a here string. On Mon, Jul 26, 2010 at 8:02 PM, Linda Walsh b...@tlinx.org wrote: Huh. Triple redirect...  Thanks! On 7/26/2010 5:53 PM, Chet Ramey wrote: On 7/26/10 6:25 PM, Linda Walsh wrote:  I don't know if there's an easy way, but if not would you consider an RFE -- Is

Re: syntax error when setting variable in front of while

2010-08-06 Thread Dennis Williamson
while is a compound command. Only simple commands can have preceding variable assignments. From man bash: The environment for any simple command or function may be augmented temporarily by prefixing it with parameter assignments, as described above in PARAMETERS. These assignment

Re: bash 4.1 command substitution

2010-08-09 Thread Dennis Williamson
I can't reproduce your problem. Does this work?: three=$( data) echo three=$three On Fri, Aug 6, 2010 at 12:31 PM, John Kelly j...@isp2dial.com wrote: bash --version GNU bash, version 4.1.7(1)-release (i586-pc-interix3.5) #! /usr/local/bin/bash one=`cat data` echo one=$one two=$(cat

Re: How to inherent non-zero exit status using pipe?

2010-08-11 Thread Dennis Williamson
However, if your pipe is in a command substitution or other subshell, PIPESTATUS won't be useful. You'll have to use pipefail. $ set +o pipefail $ var=$(false | true) $ declare -p PIPESTATUS# shows the status of the assignment, not the false declare -a PIPESTATUS='([0]=0)' $ var=$(false |

Re: \c escape within $'...' can produce mangled UTF-8

2010-08-15 Thread Dennis Williamson
This leap of illogic is beyond my ken. As a counterexample, \x{...} escape can consume an unlimited number of bytes while producing a single byte. It only consumes two bytes on my system (or one if it's followed by another escape or a closing quote). Because the documentation says

Re: Bash style of if-then-else?

2010-08-23 Thread Dennis Williamson
If you're writing a Bash-specific script then it's preferable to use double square brackets (see http://mywiki.wooledge.org/BashFAQ/031). if [[ -f $file ]] then do something fi I prefer forms using the fewest number of semicolons, but I really don't think it matters. Consistency is more

Re: edit-and-execute-command; minus the execute part?

2010-08-24 Thread Dennis Williamson
One workaround would be to bind the keystroke to a macro that inserts a comment character at the beginning of the line before doing edit-and-execute-command. Then when you exit the editor the comment will be executed then you can press up arrow to retrieve the line and delete the comment character

Re: File name/Line numbers with tracing output.

2010-08-24 Thread Dennis Williamson
On Tue, Aug 24, 2010 at 2:44 AM, Joachim Schmitz nospam.j...@schmitz-digital.de wrote: Edward Peschko wrote: All, I've been working lately at upgrading my debugging tools and procedures, and have come to looking how I can improve debugging bash. I know about bash -x , but its terribly

Re: setting a variable from a function called from PS1

2010-08-25 Thread Dennis Williamson
PROMPT_COMMAND doesn't create a subshell. xyz () { ((num++)); date; echo -n num: $num; } PROMPT_COMMAND='xyz' PS1=' ' On Wed, Aug 25, 2010 at 11:20 AM, E R pc88m...@gmail.com wrote: I've been trying to get a function called from PS1 to set a variable, e.g.: num=1 function xyz {  ((num++))

Re: Wanted: bash enhancement... non-blocking 'wait'

2010-09-03 Thread Dennis Williamson
On Fri, Sep 3, 2010 at 3:12 PM, Philip Prindeville phil...@redfish-solutions.com wrote:  On 9/3/10 10:44 AM, Eric Blake wrote: On 09/02/2010 04:44 PM, Philip Prindeville wrote: I wanted to check in and see if there was a chance of this feature being accepted upstream before I spent any time

Re: asking for a better way to implement this

2010-09-26 Thread Dennis Williamson
On Sun, Sep 26, 2010 at 3:42 PM, Christopher Roy Bratusek zang...@freenet.de wrote: btw. How can I remove the last arguement ${!#} ? I tried args=${@:-${!#}} but that won't work. Chris That says substitute the last argument if there are no arguments (pretty much impossible). Try this:

Re: bash inserts semicolon into history when using here-document

2010-10-05 Thread Dennis Williamson
On Mon, Oct 4, 2010 at 7:26 PM, Robert Citek robert.ci...@gmail.com 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'

Negative or zero arguments to yank-last-arg in bound keystrokes

2010-11-08 Thread Dennis Williamson
Configuration Information [Automatically generated, do not change]: Machine: i686 OS: linux-gnu Compiler: gcc Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='i686' -DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='i686-pc-linux-gnu' -DCONF_VENDOR='pc' -DLOCALEDIR='/usr/local/share/locale'

Re: Bash History Files

2010-11-09 Thread Dennis Williamson
See http://stackoverflow.com/q/103944/26428 On Tue, Nov 9, 2010 at 12:58 AM, Ajay Jain ajay...@gmail.com wrote: Hi, I use bash via Xterm. As a result I open multiple Xterm windows. When I type commands on the shell, they get saved only for that particular shell's history. I want to be able

Re: Issue with Getopts

2010-11-14 Thread Dennis Williamson
It would be helpful if you posted the error message. When you say normally, I assume you mean bash -c script.sh Most likely the first line of your script is something other than: #!/bin/bash On Mon, Nov 15, 2010 at 1:11 AM, Ajay Jain ajay...@gmail.com wrote: Hi, I use 'getopts' in my shell

Compiling Bash 2.05b (patched) gives error: label at end of compound statement [solved]

2010-11-22 Thread Dennis Williamson
Compiling Bash 2.05b with seven patches applied. malloc.c: In function ‘internal_free’: malloc.c:881: error: label at end of compound statement make[1]: *** [malloc.o] Error 1 Adding a semicolon on the line after this label satisfies the picky gcc 4.4.1 (actually since 3.4?). This is just FYI

Re: blink-matching-paren doesn't blink

2010-11-22 Thread Dennis Williamson
) enabled. On Mon, Nov 22, 2010 at 3:18 PM, Chet Ramey chet.ra...@case.edu wrote: On 11/22/10 3:36 PM, Dennis Williamson wrote: When I do bind -v one of the settings I see is set blink-matching-paren on It's not supposed to be enabled by default.  (It's also not documented.) Since a function

Re: echo ${HOME#$*/} segfaults

2010-12-01 Thread Dennis Williamson
But not when $* is not empty: $ set -- foo $ echo ${HOME#$*/} /home/username On Tue, Nov 30, 2010 at 7:43 PM, David Rochberg rochb...@google.com wrote: Configuration Information [Automatically generated, do not change]: Machine: x86_64 OS: linux-gnu Compiler: gcc Compilation CFLAGS:  

Re: Clear Screen

2010-12-01 Thread Dennis Williamson
PuTTY and gnome-terminal seem to preserve the previous output in the scrollback buffer (effectively doing a newline clear). PuTTY has a setting for this: Window/Push erased text into scrollback On Wed, Dec 1, 2010 at 3:21 PM, Greg Wooledge wool...@eeg.ccf.org wrote: On Wed, Dec 01, 2010 at

Re: comparison inside [[]] is not numeric comparison?

2010-12-09 Thread Dennis Williamson
On Fri, Nov 19, 2010 at 6:45 PM, john.ruckstuhl john.ruckst...@gmail.com wrote: In bash, a comparison inside [[/]] is lexicographic not numeric? This isn't what I expected. Which part of the documentation would set me straight?  If someone could quote the fine manual, that would be great. $

Re: comparison inside [[]] is not numeric comparison?

2010-12-09 Thread Dennis Williamson
On Thu, Dec 9, 2010 at 10:48 AM, Dennis Williamson dennistwilliam...@gmail.com wrote: On Fri, Nov 19, 2010 at 6:45 PM, john.ruckstuhl john.ruckst...@gmail.com wrote: In bash, a comparison inside [[/]] is lexicographic not numeric? This isn't what I expected. Which part of the documentation

Re: Bug in shell: buffer overflow.

2011-01-01 Thread Dennis Williamson
On my 32-bit system in Bash: $ printf '%u\n' -1 18446744073709551615 $ echo $((2**63-1)) 9223372036854775807 $ echo $((2**63)) -9223372036854775808 On Sat, Jan 1, 2011 at 11:48 AM, Stephane CHAZELAS stephane_chaze...@yahoo.fr wrote: 2010-12-31, 11:33(-07), Bob Proulx: [...] Your expressions

Re: assertion botched

2011-01-01 Thread Dennis Williamson
On Mon, Dec 27, 2010 at 6:17 AM, chloe ch...@desoutter.org 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'

Re: 'help set' missing '--'

2011-01-10 Thread Dennis Williamson
On Mon, Jan 10, 2011 at 2:06 AM, Chris F.A. Johnson ch...@cfajohnson.comwrote: On Mon, 10 Jan 2011, Jan Schampera wrote: the help output for the set builtin command misses '--'. It's there: SYNOPSIS set [--abefhkmnptuvxBCHP] [-o option-name] [arg ...] -- Chris F.A. Johnson,

Re: set -m +m -x and the element of chance or is it race conditions?

2011-01-28 Thread Dennis Williamson
On Fri, Jan 28, 2011 at 9:11 PM, jida...@jidanni.org wrote: I isolated the problem and submitted http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=611417 which I forget to X-Debbugs-cc to bash-...@gnu.org, which I should have, as it probably is a upstream problem that only the bash authors can

Proposed enhancement to bind builtin

2011-02-05 Thread Dennis Williamson
As far as I know, there is currently no way to display shell-command key bindings. I would like to propose that bind -x and bind -X without additional arguments perform this function in a manner parallel to -[sSvVpP].

Re: No Color for Bash Completion Results

2011-02-05 Thread Dennis Williamson
On Sat, Feb 5, 2011 at 1:35 PM, Roger rogerx@gmail.com wrote: When using bash completion on files within local folder, ie. $ ls ftab showing results for files starting with char f -- or any char(s) you may specify, results are not provided in color when bash, terminal and ls are configured

Re: Can someone explain this?

2011-02-11 Thread Dennis Williamson
On Fri, Feb 11, 2011 at 9:21 PM, Jon Seymour jon.seym...@gmail.com wrote: Correction - a _leading_ cd command and only a leading cd command, seems to be completely ignored in the case I described. Why is this? jon. -- Forwarded message -- From: Jon Seymour

Re: Can someone explain this?

2011-02-11 Thread Dennis Williamson
in the parent shell jon. On Sat, Feb 12, 2011 at 2:44 PM, Dennis Williamson dennistwilliam...@gmail.com wrote: On Fri, Feb 11, 2011 at 9:21 PM, Jon Seymour jon.seym...@gmail.com wrote: Correction - a _leading_ cd command and only a leading cd command, seems to be completely ignored in the case I

Re: how to workaroun 'nl' being added to input-line after 49 characters....

2011-02-13 Thread Dennis Williamson
On Sun, Feb 13, 2011 at 3:50 PM, Linda Walsh b...@tlinx.org wrote: I'm having a problem, I think,  due to my setting the prompt in 'root' mode, to a different color.  This results in me being able to enter only 49 characters on the input line before it wraps to the next line. I add an open

Re: how to workaroun 'nl' being added to input-line after 49 characters....

2011-02-14 Thread Dennis Williamson
On Mon, Feb 14, 2011 at 12:34 PM, Linda Walsh b...@tlinx.org wrote: For completeness current code (haven't fixed the DISPLAY part yet): if [ -n $_sh_interactive_shell ] ; then       shopt -s cdspell checkhash checkwinsize cmdhist dotglob extglob         shopt -s histappend hostcomplete

Re: compat31

2011-02-14 Thread Dennis Williamson
On Mon, Feb 14, 2011 at 9:14 AM, Greg Wooledge wool...@eeg.ccf.org wrote: On Mon, Feb 14, 2011 at 09:03:34AM -0600, Dennis Williamson wrote: I'm having a discussion with someone who claims that for them on Bash 4.0.33, with compat31 *off*, they are getting 3.1 behavior with quoted patterns

Re: compat31

2011-02-15 Thread Dennis Williamson
On Tue, Feb 15, 2011 at 8:45 AM, Roman Rakus rra...@redhat.com wrote: On 02/14/2011 04:03 PM, Dennis Williamson wrote: I'm having a discussion with someone who claims that for them on Bash 4.0.33, with compat31*off*, they are getting 3.1 behavior with quoted patterns in a =~ match

Bash 4.2 printf %()T seems to ignore TZ

2011-02-15 Thread Dennis Williamson
When I ran make test I noticed a discrepancy in a couple of the times output during the printf tests. I pulled out the relevant section and this is what I get: LC_ALL=C LANG=C SECS=1275250155 export TZ=EST5EDT printf %()T\n $SECS printf %(%e-%b-%Y %T %Z)T\n $SECS # added %Z result: 15:09:15

Re: [bash4.2] ${v//[/} bug?

2011-02-15 Thread Dennis Williamson
On Tue, Feb 15, 2011 at 9:16 PM, Clark J. Wang dearv...@gmail.com wrote: On Wed, Feb 16, 2011 at 9:59 AM, Chet Ramey chet.ra...@case.edu wrote: On 2/15/11 6:18 AM, Clark J. Wang wrote: For following script: var='[hello' echo ${var//[/} With bash 4.1 it outputs hello but with 4.2 it

Re: [bash4.2] ${v//[/} bug?

2011-02-15 Thread Dennis Williamson
On Tue, Feb 15, 2011 at 9:54 PM, Dennis Williamson dennistwilliam...@gmail.com wrote: On Tue, Feb 15, 2011 at 9:16 PM, Clark J. Wang dearv...@gmail.com wrote: On Wed, Feb 16, 2011 at 9:59 AM, Chet Ramey chet.ra...@case.edu wrote: On 2/15/11 6:18 AM, Clark J. Wang wrote: For following script

Re: Bash 4.2 printf %()T seems to ignore TZ

2011-02-16 Thread Dennis Williamson
On Wed, Feb 16, 2011 at 7:22 AM, Greg Wooledge wool...@eeg.ccf.org wrote: On Tue, Feb 15, 2011 at 09:49:16PM -0600, Dennis Williamson wrote: SECS=1275250155 export TZ=EST5EDT printf %()T\n $SECS printf %(%e-%b-%Y %T %Z)T\n $SECS  # added %Z result: 15:09:15 30-May-2010 15:09:15 CDT I

Re: Patch: Corrupt display for history search in vi-mode, 256-color prompt

2011-02-22 Thread Dennis Williamson
2011/2/22 Micah Cowan mi...@cowan.name: This bug affects both readline and bash (however, it is expected that this bug is far more likely to affect bash than other typical readline-using applications). It was experienced on bash 4.1-2ubuntu4 (on Ubuntu 10.10, Maverick Meercat), but I checked

Re: Negative array subscript with unset

2011-03-12 Thread Dennis Williamson
On Sat, Mar 12, 2011 at 6:21 PM, Chris F.A. Johnson ch...@cfajohnson.com wrote:  I all versions I have tried, unsetting an array element using a  negative index fails: $ array=( q w e r t y ) $ unset 'array[-1]' bash: [-1]: bad array subscript --   Chris F.A. Johnson,

Re: How to do? Possible?

2011-07-25 Thread Dennis Williamson
On Mon, Jul 25, 2011 at 4:45 PM, Linda Walsh b...@tlinx.org wrote: Linda Walsh wrote: Bob Proulx wrote: Yes, but it is a fork(2) of the parent shell and all of the variables from the parent are copied along with the fork into the child process and that includes non-exported variables.  

Re: How to do? Possible?

2011-07-25 Thread Dennis Williamson
Sorry, I overlooked the indirection (and the missing semicolon). On Mon, Jul 25, 2011 at 10:18 PM, Bob Proulx b...@proulx.com wrote: Dennis Williamson wrote: Linda Walsh wrote: GLOBAL=hi there {foo=GLOBAL echo ${!foo}; } Note that this tickles a problem since foo isn't set before $foo

Re: bug: return doesn't accept negative numbers

2011-08-05 Thread Dennis Williamson
return (and exit) returns an exit code between 0 and 255. Zero means true and anything else means false If you want a function to return a value, use printf or echo. On Fri, Aug 5, 2011 at 6:41 PM, Linda Walsh b...@tlinx.org wrote: I guess I don't use negative return codes that often in

Re: Inline `ifdef style` debugging

2011-08-08 Thread Dennis Williamson
On Mon, Aug 8, 2011 at 3:47 AM, Roger rogerx@gmail.com wrote: I'm doing some research for one of my scripts and always liked the C style ifdef inline debug statements. The following script seems to work just fine when using the echo command instead of the currently used printf command.

Is bash dying or dead (was Re: 4.1 is $((( ))) an 'official operator, if $(( )) isn't?

2011-08-10 Thread Dennis Williamson
I thought the $( ) was necessary to make the inner (()) an arithmetic expression...  Does it execute in a sub process? No, $( ) is for process substitution, $(( )) is for an arithmetic context. I normally (in Bash), use (( )) outside the whole expression since it gives me complete freedom of

Re: Syntax Question...

2011-08-13 Thread Dennis Williamson
On Sat, Aug 13, 2011 at 6:41 PM, Linda Walsh b...@tlinx.org wrote: I want to have an array of  'names'. given a name, X, I had a prefix, _p_, so have _p_X, I want to access / manipulate it as an array. so given I pass in a name in a var, I have to use 'indirect' syntax: ${!name} But

Re: Syntax Question...

2011-08-14 Thread Dennis Williamson
On Sun, Aug 14, 2011 at 6:31 PM, Linda Walsh b...@tlinx.org wrote: Re:   BashFAQ/006: http://mywiki.wooledge.org/BashFAQ/006 Pierre Gaston wrote: Linda: please show quote the section that shows using an variable that holds the name of an array to be used (and assigned to)  else ...

Re: Syntax Question...

2011-08-15 Thread Dennis Williamson
On Mon, Aug 15, 2011 at 2:45 AM, Linda Walsh b...@tlinx.org wrote: ` Linda Walsh wrote: The latest error I got is a a simple type -- most of them probably are, with that many lines of code in ~3-4 weeks, there's bound to be -- trouble is I'm stubborn sometimes about 'punishing myself''

Re: Syntax Question...

2011-08-16 Thread Dennis Williamson
On Mon, Aug 15, 2011 at 10:19 PM, Linda Walsh b...@tlinx.org wrote: How do I determine the location of my script? http://mywiki.wooledge.org/BashFAQ/028 ???  I don't understand the need for complexity -- what I have works.  Its a few lines@ most -- I use the same in perl.  has worked for

Re: Syntax Question...

2011-08-16 Thread Dennis Williamson
On Tue, Aug 16, 2011 at 4:11 PM, Linda Walsh b...@tlinx.org wrote: Dennis Williamson wrote:   Who's Greg?  I mean before some days ago and other than seeing the name on this list, who is he from Adam that someone should think his FAQ is important? I don't know the name other than

Re: BASH_SUBSHELL count not counting?

2011-08-29 Thread Dennis Williamson
On Mon, Aug 29, 2011 at 7:24 PM, Roger rogerx@gmail.com wrote: Within GNU Screen session VTE: roger@localhost2 ~ $ bash 0 ;-) roger@localhost2 ~ $ ps -ax |tail Warning: bad ps syntax, perhaps a bogus '-'? See http://procps.sf.net/faq.html 30840 pts/6    Ss     0:00 /bin/bash -

Re: BASH_SUBSHELL count not counting?

2011-08-29 Thread Dennis Williamson
By the way, you might find ps fx to be more useful in this case. On Mon, Aug 29, 2011 at 7:24 PM, Roger rogerx@gmail.com wrote: Within GNU Screen session VTE: roger@localhost2 ~ $ bash 0 ;-) roger@localhost2 ~ $ ps -ax |tail Warning: bad ps syntax, perhaps a bogus '-'? See

Re: Purge History of rm commands

2011-09-20 Thread Dennis Williamson
On Tue, Sep 20, 2011 at 1:34 AM, Roger rogerx@gmail.com wrote: On Mon, Sep 19, 2011 at 08:38:44AM -0400, Greg Wooledge wrote: On Sun, Sep 18, 2011 at 10:11:17PM -0800, Roger wrote: On Mon, Sep 19, 2011 at 01:37:22AM -0400, Mike Frysinger wrote: On Monday, September 19, 2011 01:18:02 Roger

Re: How to match regex in bash? (any character)

2011-09-26 Thread Dennis Williamson
On Mon, Sep 26, 2011 at 8:19 PM, Peng Yu pengyu...@gmail.com wrote: Hi, I know that I should use =~ to match regex (bash version 4). However, the man page is not very clear. I don't find how to match (matching any single character). For example, the following regex doesn't match txt.

Re: script to provide responses to prompts (badly written C program)

2011-10-31 Thread Dennis Williamson
On Mon, Oct 31, 2011 at 6:14 PM, Fernan Aguero fernan.agu...@gmail.com wrote: Hi, please accept my apologies, as this is my first post here. I'm sure I'm asking a very stupid questions, but I'm kind of stuck with this ... The Problem: a badly written C program (mktrace) that doesn't accept

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

2011-11-04 Thread Dennis Williamson
You're missing a dollar sign.

Re: What is the best to pass an array with specially characters as command line arguments?

2011-11-07 Thread Dennis Williamson
On Mon, Nov 7, 2011 at 7:23 AM, Peng Yu pengyu...@gmail.com wrote: Hi Clark, What do you mean by 1 long argument? [bash-4.2.10] # cat foo.sh v=  a b c ( a'b | set -o noglob a=( $v ) set +o noglob for i in ${a[@]}; do     echo $i done [bash-4.2.10] # bash foo.sh a b c ( a'b |

Re: How to enable infinite command history

2012-01-31 Thread Dennis Williamson
On Jan 31, 2012 11:08 AM, Ivan Yosifov iyosi...@gmail.com wrote: On Mon, 2012-01-30 at 20:16 +0200, Pierre Gaston wrote: On Mon, Jan 30, 2012 at 8:01 PM, Ivan Yosifov iyosi...@gmail.com wrote: Hi everyone, I got an admittedly basic question but I'm really at my wits' end with this.

Re: sed problem

2012-04-02 Thread Dennis Williamson
Wrong list. Your question is not about Bash and it's not about a bug in Bash.

Re: sed problem

2012-04-02 Thread Dennis Williamson
You must have replied to the wrong message. The original was about sed, not completion.

Re: Case modification fails for Unicode characters

2012-07-12 Thread Dennis Williamson
On Thu, Jul 12, 2012 at 1:57 PM, DJ Mills danielmil...@gmail.com wrote: On Thu, Jul 12, 2012 at 2:19 PM, Dennis Williamson dennistwilliam...@gmail.com wrote: s=łódź; echo ${s^^} ${s~~}' łóDź ŁÓDŹ The to-upper and the undocumented toggle operators should produce identical output

Re: Any chance of multi-dimensional arrays?

2012-11-25 Thread Dennis Williamson
On Nov 25, 2012 1:37 AM, Rene Herman rene.her...@gmail.com wrote: Good day. I know that bash arrays are 1 dimensional -- but are there any plans for providing multi-dimensional arrays? I'm currently writing a larger bash script to manage my (ogg vorbis) music collection, including

Re: fd leak with {fd}

2012-11-26 Thread Dennis Williamson
On Nov 26, 2012 2:48 PM, Chet Ramey chet.ra...@case.edu wrote: On 11/26/12 12:11 PM, Sam Liddicott wrote: I explained how in the lines of my response that you deleted. It is potentially useless because: 1. it is non-obvious, most users will not expect this behaviour (unless already

Re: multi-line like C-style comments ( /* code */ ) in bash

2013-09-07 Thread Dennis Williamson
On Sat, Sep 7, 2013 at 12:05 PM, Edik Bondarenko bondarenkoe...@gmail.comwrote: I am added function `discard_multiline_comments` which disables code between /* and */ (C-style comments). The body of the function is located in the file y.tab.c : 5140 . Can this functionality be added in the

Re: [Parameter substring expansion not work for negative offset]

2013-09-08 Thread Dennis Williamson
On Sep 8, 2013 10:44 AM, hanzlik fra...@hanzlici.cz wrote: Configuration Information: Machine: i686 OS: linux-gnu Compiler: gcc Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='i686' -DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='i686-redhat-linux-gnu' -DCONF_VENDOR='redhat'

Re: bash-4.3 bug report

2014-04-14 Thread Dennis Williamson
On Apr 14, 2014 11:52 AM, Dave Rutherford d...@evilpettingzoo.com wrote: On Mon, Apr 14, 2014 at 12:22 PM, David Binderman dcb...@hotmail.com wrote: Anyone experienced looking at the code will always need to examine it more closely to find out why it's a good idea in this case to use an

Re: Aborting prompt with Ctrl-c sets exit status variable ($?) to 130

2014-06-04 Thread Dennis Williamson
On Jun 4, 2014 2:23 PM, Jens Stimpfle deb...@jstimpfle.de wrote: Hi, please Cc: me as I'm not subscribed. When I abort a bash prompt using Ctrl-c, the $? variable is set to 130 just as if a job had been aborted. To illustrate, some terminal contents: jfs@knirps:~$ echo Hello Hello

Re: Inconsistent string comparison operators n and z

2014-06-09 Thread Dennis Williamson
On Jun 9, 2014 10:41 AM, Thibault, Daniel daniel.thiba...@drdc-rddc.gc.ca 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'

Re: Possible bug when combining Bash's process substitution with HERE-document?

2014-06-19 Thread Dennis Williamson
On Jun 19, 2014 5:00 PM, Tim Friske m...@timfriske.com wrote: Hi, first I want to thank you for your help. While searching for an alternative I came up with the following code which does not work when I have the shopt -os errexit command line at the top of my script: read -d '' -r foobar

Re: Not so useless use of cat

2014-09-12 Thread Dennis Williamson
On Sep 12, 2014 6:42 PM, Ralf Goertz me@myprovider.invalid wrote: Hi, Why do I need cat (the second on) here? $ echo first file1 $ echo second file2 $ (for i in file[12] ; do cat $i /dev/stdout ; done) | cat both $ cat both first second If I omit the | cat after the loop I

Re: Not so useless use of cat

2014-09-12 Thread Dennis Williamson
On Sep 12, 2014 7:12 PM, Bob Proulx b...@proulx.com wrote: Ralf Goertz me@myprovider.invalid wrote: Since you have used an invalid address I assume you are reading the mailing list via a web archive or other means and did not CC you. Why do I need cat (the second on) here? You don't.

Re: Not so useless use of cat

2014-09-16 Thread Dennis Williamson
On Tue, Sep 16, 2014 at 2:03 AM, Ralf Goertz me@myprovider.invalid wrote: Am Sat, 13 Sep 2014 12:53:48 -0600 schrieb Bob Proulx b...@proulx.com: Dennis Williamson wrote: Bob Proulx wrote: { for i in file[12] ; do cat $i ; done ;} both There's no need for the curly braces

Re: [PATCH] bracketed paste support

2014-10-31 Thread Dennis Williamson
On Thu, Oct 30, 2014 at 1:45 PM, Daniel Colascione dan...@dancol.org wrote: Sure, you might argue that users should paste into a trusted intermediate location --- say a text editor --- inspect the code, and then paste into the shell. That would be the prudent thing to do, but users don't

Re: Documentation Update

2014-12-12 Thread Dennis Williamson
On Fri, Dec 12, 2014 at 12:32 PM, Bob Proulx b...@proulx.com wrote: Greg Wooledge wrote: David J. Haines wrote: When started interactively, bash sets the extglob shopt; however, that fact seems to have been overlooked in the manpage. This is a compile-time setting. Your vendor

Re: Problem with brace expansion

2015-04-21 Thread Dennis Williamson
On Tue, Apr 21, 2015 at 2:44 PM, Dr Alun J. Carr alun.j.c...@runbox.com wrote: There appears to be a bug in bash when using a variable in curly brace expansion, e.g., {1..$n}. I have put the two following test scripts in the attached files looper1.sh and looper2.sh: #looper1.sh for i in

Re: Incorrect manage * in test -z

2015-04-17 Thread Dennis Williamson
On Thu, Apr 16, 2015 at 6:51 PM, Guillermo Buritica Tobon gburitic...@gmail.com wrote: Hi All. H have the next bash script code.: #!/bin/sh # Pring OK on empty input, # Print input on non-empty input read INPUT if [ -z $INPUT ]; then echo OK else echo $INPUT

Re: Incorrect manage * in test -z

2015-04-17 Thread Dennis Williamson
On Fri, Apr 17, 2015 at 8:55 AM, Eduardo A. Bustamante López dual...@gmail.com wrote: Always quote your variables. The problem comes from echo $INPUT which should be echo $INPUT Someone derped. It *should* be echo $INPUT -- Eduardo Bustamante https://dualbus.me/ Yes, I

Re: Bug, feature or just the correct behaviour (stat'ing -bash down the PATH)

2015-06-03 Thread Dennis Williamson
On Tue, Jun 2, 2015 at 5:47 PM, Dave Rutherford d...@evilpettingzoo.com wrote: It is ironic yet somehow appropriate that a fusion energy center should be having such a 1997 sort of problem today. But truly, my sympathies. :-) Dave How about a nuclear plant having a '70s kind of problem?

Re: $() does not handle nesting with case - parser precedence?

2015-06-28 Thread Dennis Williamson
On Sat, Jun 27, 2015 at 2:48 PM, Nathan Neulinger nn...@neulinger.org 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'

Re: bash displays strange characters after base64 decoding

2015-08-06 Thread Dennis Williamson
On Thu, Aug 6, 2015 at 12:45 PM, Valentin Schmidt v...@posteo.org wrote: From: v...@posteo.org To: bug-bash@gnu.org,b...@packages.debian.org Subject: bash displays strange characters after base64 decoding Configuration Information: Machine: x86_64 OS: linux-gnu Compiler: gcc Compilation

Re: Proposed Prompt Escapes

2015-11-10 Thread Dennis Williamson
On Tue, Nov 10, 2015 at 12:14 PM, Andreas Schwab <sch...@linux-m68k.org> wrote: > Dennis Williamson <dennistwilliam...@gmail.com> writes: > > > But wait, you don't need the intermediate step! It already works!!! > > > > prompt=$'\u, something about dominoe

Re: Proposed Prompt Escapes

2015-11-10 Thread Dennis Williamson
On Mon, Nov 9, 2015 at 5:09 PM, Dennis Williamson < dennistwilliam...@gmail.com> wrote: > > > On Thu, Nov 5, 2015 at 6:26 PM, Dennis Williamson < > dennistwilliam...@gmail.com> wrote: > >> It might be handy to have some of the escapes that work in $'string' &

Re: Possible bug in getopts when required argument is not supplied

2015-11-13 Thread Dennis Williamson
On Fri, Nov 13, 2015 at 10:13 AM, Griff Miller II wrote: > Configuration Information [Automatically generated, do not change]: > Machine: x86_64 > OS: cygwin > Compiler: gcc > Compilation CFLAGS: -DPROGRAM='bash.exe' -DCONF_HOSTTYPE='x86_64' > -DCONF_OSTYPE='cygwin'

Re: Proposed Prompt Escapes

2015-11-09 Thread Dennis Williamson
On Thu, Nov 5, 2015 at 6:26 PM, Dennis Williamson < dennistwilliam...@gmail.com> wrote: > It might be handy to have some of the escapes that work in $'string' > quoting to also work in prompts especially now with the ${parameter@P} > transformation. > > Specifically the hex

Re: ${var@P} expansion includes 0x01 and 0x02

2015-11-09 Thread Dennis Williamson
On Fri, Nov 6, 2015 at 7:51 AM, Chet Ramey <chet.ra...@case.edu> wrote: > On 11/5/15 7:45 PM, Dennis Williamson wrote: > > > That's what the \[ and \] escape sequences expand to and use to > > communicate information to readline about invisible characte

Re: Paste with null delimiter

2015-11-03 Thread Dennis Williamson
On Tue, Nov 3, 2015 at 10:29 AM, wrote: > An example is better than thousand words: > > $ seq 1 2 9 > odd > $ seq 2 2 10 > even > $ paste -d "" odd even > 12 > 34 > 56 > 78 > 910 > $ paste -d"" odd even > 2 > 4 > 6 > 8 > 10 > > Like you can see, with no space between the

Re: Paste with null delimiter

2015-11-03 Thread Dennis Williamson
ween the option and its parameter. > > Abcs, > Julio > @juliobash > > Próximos cursos de Shell > Cidade Local Período > São Paulo 4Linux 07/12 a 11/12 > Dou treinamento de Shell em qualquer cidade. > Para mais detalhes, me mande um e-mail. > > > 2015-11-03 15

Bash 4.4 beta - parameter transformation - parameter attributes

2015-11-02 Thread Dennis Williamson
I considered help-bash for this, but I settled on bug-bash since it's about an in-development version. $ colors=(red green blue) $ printf '%s\n' "${colors[*]@a}" a a a Which is consistent with the documentation: a The expansion is a string consisting of flag values

Proposed Prompt Escapes

2015-11-05 Thread Dennis Williamson
It might be handy to have some of the escapes that work in $'string' quoting to also work in prompts especially now with the ${parameter@P} transformation. Specifically the hex, unicode and control ones: \xHH, \u, \U and \cx. I presume that the dollar-single-quote escapes should not

Re: why must bash zap last search string just because we hit ^C?

2015-10-16 Thread Dennis Williamson
On Fri, Oct 16, 2015 at 1:50 PM, Chet Ramey wrote: > On 10/16/15 3:19 AM, 積丹尼 Dan Jacobson wrote: > > Type ^Racb^C^R^R > > (Search backwards for abc, then hit ^C, then try searching backwards > > some more using the last search string.) > > > > My problem is why must bash

Re: why must bash zap last search string just because we hit ^C?

2015-10-17 Thread Dennis Williamson
On Oct 17, 2015 9:06 PM, "積丹尼 Dan Jacobson" wrote: > > DW> On Fri, Oct 16, 2015 at 1:50 PM, Chet Ramey wrote: > > DW> ^C rudely aborts the entire operation. Why assume you want to save any > DW> of the context? > > Because I got a phone call:

Re: Inconsistent arithmetic evaluation of parameters

2015-09-01 Thread Dennis Williamson
On Tue, Sep 1, 2015 at 4:24 PM, Andreas Schwab <sch...@linux-m68k.org> wrote: > Dennis Williamson <dennistwilliam...@gmail.com> writes: > > > $ echo $((foo)) # expansion succeeds, indirection fails > > dash: 4: Illegal number: bar > > The indirection didn't f

Re: Inconsistent arithmetic evaluation of parameters

2015-09-01 Thread Dennis Williamson
On Tue, Sep 1, 2015 at 3:23 PM, Greg Wooledge <wool...@eeg.ccf.org> wrote: > On Tue, Sep 01, 2015 at 03:13:57PM -0500, Dennis Williamson wrote: > > The version of dash I have handy (0.5.7) has math support which IMHO is > > broken: > > > > $ foo=bar > > $ b

  1   2   >