Re: square bracket vs. curly brace character ranges

2012-09-17 Thread Greg Wooledge
On Sat, Sep 15, 2012 at 06:12:24PM -0600, Bob Proulx wrote: I don't know so I will ask. Isn't the problem endemic to glibc? Do other libc's such as HP-UX or AIX or other have this same issue? I am out of touch on the details of them these days. imadev:/tmp/greg$ uname -a HP-UX imadev

Re: problem with command sort

2012-10-01 Thread Greg Wooledge
On Mon, Oct 01, 2012 at 11:14:31AM +, eduardo.damasio-da-co...@stfc.ac.uk wrote: The command sort -k 3,3 lixo lixo4 does not sort lixo as I was expecting. For example, by line 385 lixo4 shows: 69.1875 -59.2511 1.00242e-05 70.875 -62.0592 1.00242e-05 145.125 -74.9763 1.00252e-06

Re: a recursion bug

2012-10-02 Thread Greg Wooledge
On Tue, Oct 02, 2012 at 10:01:43AM -0700, Linda Walsh wrote: On 9/28/12 9:54 AM, Yuxiang Cao wrote: test.sh: xmalloc: ../bash/unwind_prot.c:308: cannot allocate 172 bytes (8359936 bytes allocated) Why shouldn't bash fail at the point it hits resource exhaustion and return an error condition

loadable support for HP-UX 10 (bash 4.2)

2012-10-05 Thread Greg Wooledge
Here's an updated version of a patch I did a few years ago to add loadable support for bash under HP-UX 10. The previous patch was for bash 4.0. This one has been updated for bash 4.2. It is fundamentally the same patch, just with different context and line numbers and stuff, so that it applies

examples/loadables/getconf.c

2012-10-05 Thread Greg Wooledge
I've been staring at this for way too long now and I can't figure it out. imadev:/var/tmp/bash/bash-4.2/examples/loadables$ make /net/appl/gcc-3.3/bin/gcc -fpic -DHAVE_CONFIG_H -DSHELL -DHPUX -g -O2 -I. -I.. -I../.. -I../../lib -I../../builtins -I../../include -I/var/tmp/bash/bash-4.2

Re: examples/loadables/getconf.c

2012-10-05 Thread Greg Wooledge
On Fri, Oct 05, 2012 at 05:20:23PM +0200, Andreas Schwab wrote: Greg Wooledge wool...@eeg.ccf.org writes: Line 1209 says: # if (ULLONG_MAX != LLONG_MAX) LLONG_MAX expands to: ((long long int) (~ (long long int) 0 - ((long long int) ((! ((long long int) 0 (long long int) -1

Re: set -e (no || or )

2012-10-12 Thread Greg Wooledge
On Fri, Oct 12, 2012 at 06:55:28AM -0400, Sergey Fadeev wrote: Why doesn't it exit the shell? $ set -e $ echo $(false) Because the exit status of echo is 0.

Re: set -e (no || or )

2012-10-15 Thread Greg Wooledge
On Sun, Oct 14, 2012 at 05:21:05PM -0700, Linda Walsh wrote: Steven W. Orr wrote: Seriously, can we just put a trap on all messages to this list that have the string 'set -e' in it? Just point the sender to a message that tells them to not use it. Seriously -- why not just fix it?

Re: Need help for bash function return value

2012-10-15 Thread Greg Wooledge
On Mon, Oct 15, 2012 at 10:04:39AM +0800, Tinni wrote: Thank you so much  for your reply and  explanation. So, you're trying to retrieve 3 separate (string?) values from a remote system. Yes. Why not simply prompt the user for the information on the local system and skip the ssh call

Re: Command substitution and errexit

2012-10-15 Thread Greg Wooledge
On Mon, Oct 15, 2012 at 04:00:01PM -0400, DJ Mills wrote: I'm also not entirely sure what you mean by errexit will always be stored as off. My interpretation is that he wants to write a portable function for someone else to use, and that he wants to use errexit while inside it, and therefore he

Re: Command substitution and errexit

2012-10-15 Thread Greg Wooledge
On Tue, Oct 16, 2012 at 12:01:56AM +0300, Nikolai Kondrashov wrote: I'm trying to implement a pair of functions that would save/restore option state onto/from a stack, so I could modify options temporarily for some parts of code. I've worked around this problem already and it is not the

Re: Command substitution and errexit

2012-10-16 Thread Greg Wooledge
On Mon, Oct 15, 2012 at 08:08:10PM -0400, DJ Mills wrote: done (set -o) Huh... that's interesting. I wouldn't have expected it, but it turns out you don't lose the value of errexit in a process substitution the way you do in a command substitution. imadev:~$ bash -c 'set -e; x=$(set +o); grep

Re: output of `export -p' seems misleading

2012-11-09 Thread Greg Wooledge
On Fri, Nov 09, 2012 at 11:07:28AM -0500, Chet Ramey wrote: On 11/9/12 4:09 AM, wuya wrote: 2. this format gives user an implication that by executing these `declare' commands, all those variables got exported, but this is only partly true as it fails in functions. That's not quite

Re: output of `export -p' seems misleading

2012-11-09 Thread Greg Wooledge
On Fri, Nov 09, 2012 at 11:18:24AM -0500, Greg Wooledge wrote: restore_environment() { set -o posix eval $saved_output_of_export_dash_p set +o posix } Err, what I meant was: save_environment() { set -o posix saved_env=$(export -p) set +o posix } restore_environment() { eval

Re: problem with extended regular expression in bash 4.1

2012-11-26 Thread Greg Wooledge
On Sat, Nov 24, 2012 at 10:29:30PM +, Lawrence Steeger wrote: Alex Chupin (achupin achupin at cisco.com writes: $ bash --version; s=12345;if [[ $s =~ '^[0-9]+$' ]]; then echo it is a number; else echo it is NOT a number; fi The single quotes are being used in the match. If you remove

Re: Any chance of multi-dimensional arrays?

2012-11-26 Thread Greg Wooledge
On Sun, Nov 25, 2012 at 06:33:19AM +0100, Rene Herman wrote: I'm currently writing a larger bash script to manage my (ogg vorbis) music collection, including maintaining tags. Vorbis files can and (mine) often will contain repeated tags such as, say, artist=David Crosby and artist=Graham

Re: How to presence-detect an array variable or subscript thereof with `test -v`?

2012-11-27 Thread Greg Wooledge
On Tue, Nov 27, 2012 at 07:57:28PM +0100, Tim Friske wrote: I came accross the `-v` option of the `test` command and wondered how I would possibly test not only string- and integer- but also array variables as a whole and in parts. Sounds more like a help-bash question than a bug-bash

Re: Cron jobs, env vars, and group ID ... oh my

2012-11-28 Thread Greg Wooledge
On Wed, Nov 28, 2012 at 09:10:02AM -0800, Mun wrote: I need to run a script via cron that in turn launches a script to set up the requisite environment variables needed for a successive script that is called. Moreover, I need to change my group ID in order for the scripts called within the

Re: Several issues with coprocesses regarding exit status

2012-12-11 Thread Greg Wooledge
On Tue, Dec 11, 2012 at 02:31:28PM -0500, DJ Mills wrote: First of all, the man page and help output state: `The return status of a coprocess is the exit status of command.' No matter what, coproc seems to always return true. To reproduce: coproc false || echo error1 2; wait

Re: Question about the return value of 'local'

2012-12-14 Thread Greg Wooledge
On Fri, Dec 14, 2012 at 08:37:02AM +0100, Francis Moreau wrote: Then maybe an option should be added to 'local' to display the full description that one can get from the manual, or maybe change the behaviour of '-m' switch ? Almost every builtin command has a shorter and less informative

Re: AW: Questions to bash read builtin functionality

2012-12-19 Thread Greg Wooledge
On Wed, Dec 19, 2012 at 04:49:32PM -0500, Chet Ramey wrote: I get the same results if I run the pipeline in an interactive shell. This is pretty much what I expect. The whitespace and newlines will disappear due to read's $IFS processing if they're first or last in the string. Which is why

Re: xargs combined with awk

2012-12-20 Thread Greg Wooledge
On Thu, Dec 20, 2012 at 07:43:50AM -0800, giuseppe.amatu...@gmail.com wrote: for dir in UA_tile_tif_pop_txt UA_buf10_tile_tif_pop_txt UA_buf20_tile_tif_pop_txt UA_buf30_tile_tif_pop_txt UA_buf40_tile_tif_pop_txt UA_buf50_tile_tif_pop_txt ; do echo $dir ; done | xargs -n 1 -P 6 bash -c '

Re: Is direxpand available yet (to fix dirspell)?

2013-01-09 Thread Greg Wooledge
On Tue, Jan 08, 2013 at 10:26:19PM +, John Caruso wrote: I checked the bash source but couldn't suss out (in a brief look) how minor bash versions are accounted--there's no 4.2.10 or 4.2.24 source, just 4.2 source plus a bunch of patches, and it's not clear if those patches have made it

Re: a problem of mapfile

2013-01-11 Thread Greg Wooledge
On Fri, Jan 11, 2013 at 10:21:55PM +0800, Ma Shimiao wrote: I used commands as follows: $seq 5 | mapfile -C echo -c1 0 1 1 2 2 3 3 4 4 5 I would have expectd 1,2,3,4,5 above from thehelp mapfile. Is it a bug of mapfile? The help says: When CALLBACK is evaluated, it is

checkwinsize only works in interactive shells

2013-01-11 Thread Greg Wooledge
shopt -s checkwinsize only works in interactive shells. However, this is not mentioned in the manual. Tested in Bash 4.2.37. #!/bin/bash trap 'echo COLUMNS is now $COLUMNS' WINCH test -z $COLUMNS COLUMNS=$(tput cols) shopt -s checkwinsize while sleep 1; do :; done Run in a terminal, resize

Re: typeset -p on an empty integer variable is an error. (plus -v test w/ array elements)

2013-01-14 Thread Greg Wooledge
On Sun, Jan 13, 2013 at 03:31:24AM +0100, John Kearney wrote: set -o errexit test_func() { [ ! -d test ] echo test2 } echo test3 test_func echo test4 now so long as test doesn't exist in the cwd it should errexit. at least it did for me just now. Cannot reproduce. imadev:~$ cat

Re: typeset -p on an empty integer variable is an error. (plus -v test w/ array elements)

2013-01-14 Thread Greg Wooledge
On Mon, Jan 14, 2013 at 08:08:53PM +0100, John Kearney wrote: this should exit. #!/bin/bash set -e f() { test -d nosuchdir echo no dir; } echo testings f echo survived OK, cool. That gives me more ammunition to use in the war against set -e.

Re: about one feature in V4.2 against V4.1

2013-01-15 Thread Greg Wooledge
On Tue, Jan 15, 2013 at 11:30:39AM -0500, DJ Mills wrote: I believe that's referring to var=value command, as in the syntax to export a variable into commands environment. readonly a=3 a=2 echo foo I thought that was what it meant, too, but I couldn't reproduce the bug that it was claiming

Re: | in bash?

2013-01-22 Thread Greg Wooledge
On Tue, Jan 22, 2013 at 06:56:31AM -0500, Steven W. Orr wrote: By that logic, foo 21 | bar should not work, but it does. It takes stderr and dups it to stdout, and *then* takes stdout and send it to a pipe. Incorrect. The pipeline is created first, and *then* the dup (21) is performed.

Re: | in bash?

2013-01-22 Thread Greg Wooledge
On Tue, Jan 22, 2013 at 07:45:10PM +0100, Andreas Schwab wrote: Greg Wooledge wool...@eeg.ccf.org writes: On Tue, Jan 22, 2013 at 06:56:31AM -0500, Steven W. Orr wrote: foo 21 | bar The pipeline is created first, and *then* the dup (21) is performed. This is true, but not obviously so

Re: builtin read -d behaves differently after set -e#

2013-02-06 Thread Greg Wooledge
On Wed, Feb 06, 2013 at 12:39:45AM +0100, Tiwo W. wrote: When using this in a script of mine, I noticed that this fails when errexit is set (set -e). Most things do. set -e is crap. You should consider not using it. * why does it work with set +e ? Because set +e

Re: builtin read -d behaves differently after set -e#

2013-02-06 Thread Greg Wooledge
On Wed, Feb 06, 2013 at 07:12:01PM +0100, John Kearney wrote: IFS= read -rd '' var2 EOF || true should work. Which is essentially equivalent to doing set +e before, and set -e again right after. In either case, you're temporarily working around the brokenness of set -e for a single command.

Re: Waiting for _any_ background process to terminate.

2013-02-11 Thread Greg Wooledge
On Mon, Feb 11, 2013 at 06:59:35PM +, Alan Mackenzie wrote: From a bash script, I'd like to be able to start several subtasks and react to any one of them completing. I don't think I can do this with the current bash. The `wait' function either waits on a specified subtask to finish, or

Re: [Parameter Expansion] bug in ${variable% *}

2013-02-12 Thread Greg Wooledge
On Mon, Feb 11, 2013 at 06:50:49PM +0100, Dashing wrote: $ ./pe 'mplayer foo1\ foo2\ foo3\ 4\ 5\ foo6\ 7' :--Mistake--: :--Mistake--: Whatever you're doing, it's wrong. ./pe mplayer foo1\ foo2\ foo3\ 4\ 5\ foo6\ 7 #!/bin/bash prog=$1 shift exec $prog extra args go here $@ THAT is how a

Re: [Parameter Expansion] bug in ${variable% *}

2013-02-12 Thread Greg Wooledge
On Tue, Feb 12, 2013 at 02:37:03PM +0100, Dashing wrote: For my purposes this is irrelevant, because the nature of the script from which my example code derived is tab completion. READLINE_LINE will contain mplayer foo1\ foo2\ etc. Then you are still doing something wrong. imadev:~$ args

Re: eval doesn't close file descriptor?

2013-02-12 Thread Greg Wooledge
On Tue, Feb 12, 2013 at 11:07:06AM -0500, Matei David wrote: On a different but related note, I hate having to do eval to manipulate an fd stored in a variable. Why doesn't 'llfd $x-' work, especially since 'llfd $x' works just fine... so by the time is handled, the variable substitutions

Re: printf question

2013-02-12 Thread Greg Wooledge
On Tue, Feb 12, 2013 at 04:20:53AM -0800, laurent.tes...@gmail.com wrote: liste=`ls *.T02` This is broken because filenames may contain spaces, newlines, etc. Use an array instead: liste=(*.T02) See http://mywiki.wooledge.org/BashPitfalls for an explanation of some of the issues. This type

Re: Should this be this way?

2013-02-26 Thread Greg Wooledge
POSIX specifies the behavior of a shell. This tells Chet how he has to make Bash behave (with some leeway). There are all kinds of silly little details and ambiguities that Chet has to worry about. However, YOU as a shell script writer do not have to worry about all that crap. All you have to

Re: Should this be this way?

2013-02-26 Thread Greg Wooledge
On Tue, Feb 26, 2013 at 01:27:35PM -0800, Linda Walsh wrote: Except it isn't a script -- it's input that came from the terminal, that got repetitively edited using vi mode, until it got saved in a file so it could continue to be edited, and stay on the screen while executing it in the

Re: ignoring current shell and always running posix shell? Re: Should this be this way?

2013-03-14 Thread Greg Wooledge
On Wed, Mar 13, 2013 at 11:52:54PM -0700, Linda Walsh wrote: Sorta makes the idea of a restricted shell a bit less useful. Honestly, a restricted shell is usually a pitiful thing that would be a joke, except it's not even funny. It's what people tried to use for security back in like 1990 when

Re: weird problem -- path interpretted/eval'd as numeric expression

2013-03-27 Thread Greg Wooledge
On Wed, Mar 27, 2013 at 11:29:38AM -0700, Linda Walsh wrote: include lib/Util/Needroot.shh where include is a function the name of a file in my path (or an alias to define the function)... /home/law/bin/recycle_space: line 7: lib/Util/needroot.shh: division by 0 (error token is

Re: weird problem -- path interpretted/eval'd as numeric expression

2013-03-27 Thread Greg Wooledge
On Wed, Mar 27, 2013 at 12:17:21PM -0700, Linda Walsh wrote: dcl -xa _FPATH Arrays cannot be exported. The bash manual explicitly says so: Array variables may not (yet) be exported. } | ( ((!(remove||expire))) hsort -s || cat) Use of the and || operators together as a shorthand for

Re: weird problem -- path interpretted/eval'd as numeric expression

2013-03-28 Thread Greg Wooledge
On Wed, Mar 27, 2013 at 02:37:16PM -0700, Linda Walsh wrote: Greg Wooledge wrote: Array variables may not (yet) be exported. Associative arrays can't be exported either. Yeah, but they seem to get propagated anyway, I must save it somewhere like I do _FPATH... i.e. each

Re: weird problem -- path interpretted/eval'd as numeric expression

2013-03-29 Thread Greg Wooledge
On Fri, Mar 29, 2013 at 12:41:46AM -0700, Linda Walsh wrote: include was designed to search the path for functions that are relative paths. While the normal sourcepath allows searching for filenames on the search path, I don't believe (please correct if I am wrong and this works now, as

Re: weird problem -- path interpretted/eval'd as numeric expression

2013-03-29 Thread Greg Wooledge
On Fri, Mar 29, 2013 at 04:10:22PM +0100, John Kearney wrote: consider dethrophes@dethace ~ $ read -ra vals -d '' $'lkjlksda\n adasd\n:sdasda:' dethrophes@dethace ~ $ echo ${vals[0]} lkjlksda You forgot to set IFS=: for that read. imadev:~$ IFS=: read -ra vals -d '' $'lkjlksda\n

Re: setvalue builtin command

2013-04-04 Thread Greg Wooledge
On Thu, Apr 04, 2013 at 02:26:34AM -0500, Dan Douglas wrote: On Wed, Feb 6, 2013 at 11:30 AM, konsolebox konsole...@gmail.com wrote: Hi. I was wondering if we could add a builtin where we could use it as an alternative for assigning values to a parameter. And thought of a builtin name

Re: setvalue builtin command

2013-04-04 Thread Greg Wooledge
On Thu, Apr 04, 2013 at 09:11:49PM +0800, konsolebox wrote: On second thought I think we still need the function since for declare -n: a) Reference variable could not be an array. I'm not sure what you mean. But namerefs may point to arrays or associative arrays in the caller's context.

Re: invoke tilde expansion on quoted string

2013-04-04 Thread Greg Wooledge
On Thu, Apr 04, 2013 at 09:17:00PM +0800, Chris Down wrote: Perhaps my reply here[1] can help out. Only looked briefly, but it seems it could at least eliminate the calls to eval (although it doesn't support some more rare tilde expansions). Chris 1:

Re: completion no longer permits file arguments to /bin/sh

2013-04-04 Thread Greg Wooledge
On Thu, Apr 04, 2013 at 10:56:35AM -0700, Andy Valencia wrote: Description: If one has a file data.txt and a shell script x, it used to be possible to run this with sh x dattab and have the file argument completed to data.txt. As of Debian Wheezy update completion

Re: to - Bookmark file system locations in bash on POSIX-like systems

2013-04-08 Thread Greg Wooledge
On Thu, Apr 04, 2013 at 08:51:19PM -0500, Mara Kim wrote: The biggest benefit is that it is just plain easier than managing a directory of symbolic links on your own. I am extremely lazy. Here is an example use case. At the end of a work day, I like to bookmark the folder I am working in on

Re: setvalue builtin command

2013-04-08 Thread Greg Wooledge
On Fri, Apr 05, 2013 at 09:15:10AM +0800, konsolebox wrote: The only thing left here is that we can't have error control like when we are to create generally shared library scripts e.g.: function lib_something { declare -n VAR=$1 /devnull || { # error message is not suppressed :

Re: invoke tilde expansion on quoted string

2013-04-08 Thread Greg Wooledge
On Sun, Apr 07, 2013 at 01:13:09AM -0700, Linda Walsh wrote: getent passwd 'Domain Administrator' Domain Administrator:x:500:18:Domain Admin accnt:/home/root:/bin/bash getent(1) is fine where it's available, but it's not a standard tool, so you can only use it on systems that have it. If

Re: setvalue builtin command

2013-04-08 Thread Greg Wooledge
On Mon, Apr 08, 2013 at 10:32:40AM -0400, Chet Ramey wrote: One clarification: a variable is unset unless it has had a value assigned. There might be some placeholder there with some type information, but the variable is unset. There might be some inconsistencies in how bash treats such

Re: invoke tilde expansion on quoted string

2013-04-09 Thread Greg Wooledge
On Mon, Apr 08, 2013 at 05:13:46PM -0700, Linda Walsh wrote: Greg Wooledge wrote: getent(1) is fine where it's available, but it's not a standard tool, so you can only use it on systems that have it. Have you encountered it on other linux systems? It is present on Debian 3.1 (the oldest

Re: Possible bug with BASH V4: The $!

2013-04-11 Thread Greg Wooledge
On Thu, Apr 11, 2013 at 01:05:43PM +, Lenga, Yair wrote: Is it possible to add back the functionality to allow the child process to somehow retrieve it's OWN PID. You are looking for the BASHPID variable, which expands to the process ID of the current bash process (even in a subshell).

Re: Possible bug with BASH V4: The $!

2013-04-11 Thread Greg Wooledge
On Thu, Apr 11, 2013 at 04:15:45PM +, Lenga, Yair wrote: + The man page list BASH_VERSION, etc., but no indication of BASHPID. It's probably a good idea to put a note next to '$!' about BASHPID. It is certainly in the man page: BASHPID Expands to the process ID of the

Re: Logical operators in arithmetic evaluation: documentation vs implementation

2013-04-18 Thread Greg Wooledge
On Thu, Apr 18, 2013 at 11:59:40AM +0200, and...@coolbox.se wrote: The ARITHMETIC EVALUATION section of the man page claims equivalence with C for all the operators, but in reality bash does not perform short circuit evaluation, which implies that the logical operators do NOT produce the same

Re: bash doesn't display tabs for tabs -- ignores tabstops.

2013-04-22 Thread Greg Wooledge
On Sun, Apr 21, 2013 at 12:25:20AM -0700, Linda Walsh wrote: If I 'reedit my last statement, it indents 8 spaces/tab. What does this sentence mean? I am completely stumped. What is the sequence of steps you are actually performing?

Re: bash doesn't display tabs for tabs -- ignores tabstops.

2013-04-22 Thread Greg Wooledge
On Mon, Apr 22, 2013 at 10:54:35AM -0700, Linda Walsh wrote: Type in this: echo 'while read fn;do tabd=${fn%.zip} This is where I lose you completely. If I press Tab where you indicate, nothing happens at all. If I press Tab twice in a row there, bash offers to tab-complete against all the

Re: bash doesn't display tabs for tabs -- ignores tabstops.

2013-04-22 Thread Greg Wooledge
On Mon, Apr 22, 2013 at 12:35:02PM -0700, Linda Walsh wrote: I.e. do whatever you do to insert a TAB there. for me, I press TAB, Others have to work around BASH's unwanted, 4.x behavior. I am not able to reproduce your problem. Here is what I did: imadev:~$ echo 'x y z' Which means

Re: cd won't change the prompt if the command is typed in the vi editor (vi mode).

2013-05-13 Thread Greg Wooledge
On Sun, May 12, 2013 at 05:50:18PM -0500, Peng Yu wrote: set -o vi. Then I type v to enter the vi editor. In the vi editor, I type 'cd /tmp'. Then, I get the following screen output. Notice that the prompt does not change immediately after the cd command. Could anybody reproduce this

Re: typeset -p manpage on it are confusing w/rt funcs

2013-06-07 Thread Greg Wooledge
On Thu, Jun 06, 2013 at 03:48:09PM -0700, Linda Walsh wrote: I wanted to test to see if a function was defined imadev:~$ unset foo imadev:~$ foo=variable imadev:~$ bar() { echo I am a function; } imadev:~$ declare -f foo /dev/null 21 ; echo $? 1 imadev:~$ declare -f bar /dev/null 21 ; echo $? 0

Re: don't just seek to the next line if the script has been edited

2013-06-07 Thread Greg Wooledge
On Fri, Jun 07, 2013 at 09:09:53PM +0800, jida...@jidanni.org wrote: Well OK but sometimes a script could be running for years, during which any change to a file will result in bash executing random bytes... This is why you don't edit an installed script in-place. Instead, you move it aside,

Re: don't just seek to the next line if the script has been edited

2013-06-07 Thread Greg Wooledge
On Fri, Jun 07, 2013 at 10:15:46PM +0800, jida...@jidanni.org wrote: Well it is going to happen anyway, so maybe bash should check by default, and not check if -o risky is set or something. It can't be that expensive. Yes it can. You're talking about adding a ridiculous amount of extra

Re: noclobber vs command not found

2013-06-10 Thread Greg Wooledge
On Sun, Jun 09, 2013 at 08:39:10AM +0800, jida...@jidanni.org wrote: # gdk-pixbuf-query-loaders | /usr/lib/i386-linux-gnu/gdk-pixbuf-2.0/2.10.0/loaders.cache bash: gdk-pixbuf-query-loaders: command not found I know it doesn't directly address your issue, but in cases like these, I find tab

Re: currently doable? Indirect notation used w/a hash

2013-06-10 Thread Greg Wooledge
On 10 Jun 2013 14:15, Chris F.A. Johnson ch...@cfajohnson.com wrote: It is not the least bit difficult with eval: eval array=( \\${$1[@]}\ ) On Mon, Jun 10, 2013 at 09:17:23PM +0800, Chris Down wrote: Enjoy your arbitrary command execution. To be fair, Chris Johnson was probably

Re: currently doable? Indirect notation used w/a hash

2013-06-10 Thread Greg Wooledge
On Mon, Jun 10, 2013 at 10:23:10AM -0400, Chris F.A. Johnson wrote: On Mon, 10 Jun 2013, Chris Down wrote: Enjoy your arbitrary command execution. Can you give me an example, using the code I posted, where that would happen? On 10 Jun 2013 14:15, Chris F.A. Johnson

Re: \H in PS1 adds the hostname without the domain to the prompt

2013-06-12 Thread Greg Wooledge
On Wed, Jun 12, 2013 at 07:37:09AM +0200, Sascha Gaspar wrote: The \H in PS1 adds the hostname without the domain to the prompt. According to the man page \h outputs the hostname up to the first `.' and \H outputs the the hostname. I think that should be the FQDN? Well, the manual

Re: corrupted input after size function (input that's not recorded by bash)

2013-06-14 Thread Greg Wooledge
On Thu, Jun 13, 2013 at 04:42:36PM -0700, Linda Walsh wrote: Chris F.A. Johnson wrote: The baskspaces (\b) are erasing your input, not the function's output. That's incorrect. A backspace character sent to a terminal device moves the cursor (or does whatever else the terminal chooses to

Re: currently doable? Indirect notation used w/a hash

2013-06-14 Thread Greg Wooledge
On Fri, Jun 14, 2013 at 06:25:12AM -0500, Dan Douglas wrote: Also forgot to mention (though it should be obvious). $ ~/doc/programs/bash43 -c 'function f { typeset -n x=$1; : $x; }; a=(yo jo); f a[\$(echo yes this even applies to namerefs2)0]' yes this even applies to namerefs No, that

Re: regex confusion -- not matching; think it should?

2013-06-19 Thread Greg Wooledge
On Thu, Jun 20, 2013 at 12:39:56AM +0800, Chris Down wrote: On 20 June 2013 00:29, DJ Mills danielmil...@gmail.com wrote: wordsplitting and pathname expansion do not occur within the [[ keyword. $ foo $ [[ foo == * ]] echo bar bar That's pattern matching, which is neither word

Re: regex confusion -- not matching; think it should?

2013-06-20 Thread Greg Wooledge
On Wed, Jun 19, 2013 at 06:12:57PM -0500, Dan Douglas wrote: Thanks to mksh, posh, etc not supporting POSIX character classes at all, I'm not so sure it's actually better in practice. (talking about standard shell pattern matching of course) I'm fairly sure nobody on the entire planet uses

Re: regex confusion -- not matching; think it should?

2013-06-21 Thread Greg Wooledge
On Fri, Jun 21, 2013 at 02:39:14AM -0500, Dan Douglas wrote: If you're writing a script in bash, you MUST NOT use the [a-z] or [A-Z] ranges, or any other alphabetic ranges, unless you are working in the POSIX locale. If you use an alphabetic range in any other locale, you invite disaster.

Re: Bash case-modifying word expansions and locales

2013-07-02 Thread Greg Wooledge
On Tue, Jul 02, 2013 at 05:36:43AM +0200, Tomasz Tomasik wrote: bash -c 'foo=??ó??w; echo ${foo^^}' ??ó??W Characters with diacritical marks are not affected. I get the same result in ISO-8859-1: imadev:~$ x='fóo'; echo ${x^^} FóO imadev:~$ locale LANG=en_US.iso88591 LC_CTYPE=en_US.iso88591

Re: Chained command prints password in Clear Text and breaks BASH Session until logout

2013-07-11 Thread Greg Wooledge
On Wed, Jul 10, 2013 at 02:54:17PM -0700, Jason Sipula wrote: ~]# mysqldump -u someuser -p somedb | mysql -u someuser -p -D someotherdb This isn't a bash issue. Mysql is prompting for a password, either on standard input or by directly opening /dev/tty. In either case, the issue is with mysql.

Re: Chained command prints password in Clear Text and breaks BASH Session until logout

2013-07-11 Thread Greg Wooledge
On Thu, Jul 11, 2013 at 10:47:12AM -0700, Jason Sipula wrote: I still think this is a bash issue. After the command terminates, you must restart your bash session to return to normal functionality. Nothing typed into the terminal displays but it does receive it. If the terminal has been messed

Re: Chained command prints password in Clear Text and breaks BASH Session until logout

2013-07-11 Thread Greg Wooledge
On Thu, Jul 11, 2013 at 10:53:11AM -0700, Jason Sipula wrote: The second issue is once the command terminates, bash session does not behave normally at all. Nothing typed into the terminal over SSH or directly on the console displays, however it does receive the keys. Also, if you repeatedly

Re: devel source tree? (doc page outdated or something broken?)

2013-07-15 Thread Greg Wooledge
On Sun, Jul 14, 2013 at 02:06:07PM -0700, Linda Walsh wrote: I was trying to find the location of the current development source. I followed the access instructions at: https://savannah.gnu.org/cvs/?group=bash http://savannah.gnu.org/git/?group=bash

Re: script with ssh and filenames with spaces

2013-07-17 Thread Greg Wooledge
On Wed, Jul 17, 2013 at 08:42:17PM +, gscant...@comcast.net wrote: I wish to ssh this command to several hosts: ls -alst dir_with_spaces for host in ${hosts[@]}; do ssh $host bash -'EOF' ls -alst your directory EOF done The - in front of the here document's delimiter

Re: read builtin. input processes improperly inheriting IFS setting

2013-07-26 Thread Greg Wooledge
On Sat, Jul 27, 2013 at 01:34:53AM +0900, David H. wrote: # The test string: $ echo $instring root:x:0:0:root:/root:/bin/bash # Gives incorrect (unexpected) output: $ ( IFS=: read -a strings ( echo $instring ) ; printf '[%s]\n' ${strings[@]} ) [root x 0 0 root

Re: read builtin. input processes improperly inheriting IFS setting

2013-07-26 Thread Greg Wooledge
On Fri, Jul 26, 2013 at 10:38:46PM +0200, Andreas Schwab wrote: Greg Wooledge wool...@eeg.ccf.org writes: Your unquoted $instring is being split into fields by bash, which is operating with IFS=: at that point. Variable assignments are supposed to be performed _after_ redirections (read

Re: Bug in function return statement in while subshell

2013-07-29 Thread Greg Wooledge
On Mon, Jul 29, 2013 at 06:36:58PM +0300, Pierre Gaston wrote: it's not clear (like it is for, say, exit) what the relationship between return and process is. I guess most people expect it to not care about subshells and just execute the statement after the function call. Most people barely

Re: Bug in function return statement in while subshell

2013-07-30 Thread Greg Wooledge
On Tue, Jul 30, 2013 at 01:15:59PM +0300, Pierre Gaston wrote: while :;do ( while :;do break 2; done);echo foo;done Should this raise an error? is the break in a loop context? what's a loop context? The break occurs in a subshell, which means it cannot communicate what I presume to be the

Re: Bug in function return statement in while subshell

2013-07-30 Thread Greg Wooledge
On Tue, Jul 30, 2013 at 04:12:07PM +0200, Roman Rakus wrote: f1() { : | while :; do return 3; done echo $? return 1 } echo $? f1; echo $? return 2 My point is that the `return 3' in while loop is in subshell and will not return from the function Correct. It will

Re: feature request: capture output of last command and make it available on some hotkey

2013-07-31 Thread Greg Wooledge
On Wed, Jul 31, 2013 at 02:09:23AM +0200, Jörn Hees wrote: i think this would be a very useful feature and i don't seem to be alone: http://stackoverflow.com/questions/5955577/bash-automatically-capture-output-of-last-executed-command-into-a-variable Bash has no knowledge of, and no way to

Re: ldapscripts unusable from within a 'while read line' loop

2013-08-01 Thread Greg Wooledge
On Thu, Aug 01, 2013 at 09:37:38AM +0200, Lakshminarasimhan Srinivasan wrote: ldapscripts do not work from inside a while read line loop. The exact same scripts were working fine until the last upgrade - #!/bin/bash echo Testing if it

Re: memory allocation bug in bash 4.2.39(1)-release

2013-08-12 Thread Greg Wooledge
On Fri, Aug 09, 2013 at 10:47:21PM -0600, Bob Proulx wrote: John Vincent wrote: echo {1..2000} it runs, but afterwards whenever I enter another command I get the error: -bash: fork: Cannot allocate memory You need to allocate more virtual memory space to your machine. You are

Re: i++ cause bad return code when result is 1

2013-08-19 Thread Greg Wooledge
On Mon, Aug 19, 2013 at 05:50:31AM +0200, Chris Down wrote: On 2013-08-18 16:57, David Lehmann wrote: The ((i++)) fails only when the result is 1. When the result is 0 or 2, it does not fail. This is a problem when 'set -e'. This is normal and expected. If the value returned in an ((

Re: child_pid of background process? (not in manpage?)

2013-08-19 Thread Greg Wooledge
On Mon, Aug 19, 2013 at 05:53:03AM +0200, Chris Down wrote: On 2013-08-18 17:46, Linda Walsh wrote: I don't find the variable for the process ID of the last started background process documented in the bash manpage... Am I just missing it, or did it get left out by accident or where did

Re: feature request: file_not_found_handle()

2013-08-20 Thread Greg Wooledge
On Mon, Aug 19, 2013 at 08:02:39PM -0700, Linda Walsh wrote: Yes, I see what you mean. I guess I'm not real certain as to why, if CDPATH=~/Documents, and I type cd Pictures/family and end up in ~/Documents/Pictures/family, then PATH shouldn't work the same way. There are several

Re: feature request: file_not_found_handle()

2013-08-20 Thread Greg Wooledge
On Tue, Aug 20, 2013 at 05:48:12PM +0300, Aharon Robbins wrote: In article mailman.403.1376999138.10748.bug-b...@gnu.org you write: 1) PATH is used by the kernel (exec family) to determine how commands are executed. The way PATH is used by the kernel is not likely to change. Having the

Re: feature request: file_not_found_handle()

2013-08-21 Thread Greg Wooledge
On Wed, Aug 21, 2013 at 02:22:24AM -0800, Ken Irving wrote: $ cat $(ambler.method dispatch) #!/bin/bash method=$1 shift test -n $method || exit for s in $(ls|shuf); do tob $s.$method $@ done As far as I can tell, this is some incredibly stupid crap thrown

Re: Empty trailing fields ignored by read

2013-08-29 Thread Greg Wooledge
On Thu, Aug 29, 2013 at 12:57:22PM -0400, DJ Mills wrote: On Thu, Aug 29, 2013 at 12:42 PM, DJ Mills danielmil...@gmail.com wrote: When using a non-default IFS (a default IFS would trim them), a single empty trailing field is ignored for read -a. IFS=: read -rd '' -a arr (printf %s

Re: -a vs -e

2013-09-05 Thread Greg Wooledge
On Wed, Sep 04, 2013 at 10:06:16PM -0700, kneuf...@gmail.com wrote: $ [ ! -e stuff.txt ]; echo $? 1 $ [ ! -a stuff.txt ]; echo $? 0 # what? Both these version show the exact same behaviour. Fedora 18, bash 4.2.45(1)-release OSX, 3.2.48(1)-release Also occurs in 4.3.0-beta.

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

2013-09-09 Thread Greg Wooledge
On Sun, Sep 08, 2013 at 11:21:56AM -0500, Dennis Williamson wrote: The man page says Note that a negative offset must be separated from the colon by at least one space... Enclosing the negative offset in parentheses also works. The reason you must use either parentheses or spaces between them

Re: [install bash] how to use patch files

2013-09-18 Thread Greg Wooledge
On Wed, Sep 18, 2013 at 11:54:13PM +0800, zxycscj wrote: I have downlaod bash-4.2.tar.gz and all the patches for it. how to use the patch files to install? http://ftp.gnu.org/gnu/bash/ bash-4.2.tar.gz http://ftp.gnu.org/gnu/bash/bash-4.2-patches/ bash42-001.sig bash42-001.txt ... gzip

Re: operator prevents backgrounding over ssh

2013-09-26 Thread Greg Wooledge
On Thu, Sep 26, 2013 at 06:27:10AM +, Hinrik Örn Sigurðsson wrote: The operator in bash seems to inhibit backgrounding when run over ssh. You can try it with the following: ssh localhost cd /tmp nohup sleep 10 /dev/null 21 The above command will wait for sleep(1) to finish before

Re: bash built-ins `true' and `false' undocumented

2013-09-27 Thread Greg Wooledge
On Fri, Sep 27, 2013 at 03:50:09PM +0530, Roland Winkler wrote: I guess there is not too much one can say about the bash built-ins `true' and `false'. Nonetheless, I suggest that the info pages should list these built-ins individually like other built-ins. Currently, the only hint on their

Re: -e and permission denied

2013-10-03 Thread Greg Wooledge
On Thu, Oct 03, 2013 at 03:18:16AM -0700, vic...@vsespb.ru wrote: -e will return file not exists, even if it does, when permission denied error happen. I am wondering if this documented/correct behaviour or no. I assume you mean that bash will return 1 (failure) for [[ -e /path/to/file ]] when

Re: Command substitution and exiting from deeply nested subshells

2013-10-07 Thread Greg Wooledge
On Sun, Oct 06, 2013 at 09:37:00PM -0300, Carlos Pita wrote: I'm not completely sure whether this is a bug or not but it seems not possible to immediately exit a shell when an error happens at 2+ levels of subshell nesting. Exiting in a subshell will never cause the parent shell to exit,

<    1   2   3   4   5   6   7   8   9   10   >