Re: Local variables overriding global constants

2013-04-03 Thread Pierre Gaston
On Wed, Apr 3, 2013 at 11:21 AM, Pierre Gaston wrote: > On Wed, Apr 3, 2013 at 11:03 AM, Chris Down wrote: > >> On 2013-04-03 11:00, Nikolai Kondrashov wrote: >> > >>>It doesn't work because you are trying to redefine an existing >> > >>>read

Re: Local variables overriding global constants

2013-04-03 Thread Pierre Gaston
On Wed, Apr 3, 2013 at 11:33 AM, Chris F.A. Johnson wrote: > On Wed, 3 Apr 2013, Pierre Gaston wrote: > > On Wed, Apr 3, 2013 at 11:03 AM, Chris Down wrote: >> >> On 2013-04-03 11:00, Nikolai Kondrashov wrote: >>> >>>> It doesn't work

Re: Local variables overriding global constants

2013-04-03 Thread Pierre Gaston
On Wed, Apr 3, 2013 at 11:50 AM, Chris F.A. Johnson wrote > > Still Nikolai has a point. > > It's not clear why readonly variable can be overridden when the variable is declared readonly in the scope of an englobing function but not if it is declared readonly in the global sco

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

2013-04-04 Thread Pierre Gaston
On Thu, Apr 4, 2013 at 11:58 AM, Mara Kim wrote: > Hi Chris! > > Actually, this is great! Style critique, plus runtime analysis. Am I > dreaming? :D > > I see your point regarding the use of variables to hold commands. Using > PATH is a much better method of handling that functionality. And w

Re: Logical operators in arithmetic evaluation: documentation vs implementation

2013-04-18 Thread Pierre Gaston
On Thu, Apr 18, 2013 at 12:59 PM, 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 resu

Re: Logical operators in arithmetic evaluation: documentation vs implementation

2013-04-18 Thread Pierre Gaston
On Thu, Apr 18, 2013 at 5:36 PM, Pierre Gaston wrote: > > > > On Thu, Apr 18, 2013 at 12:59 PM, 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

Re: ~/.bashrc not sourced for ssh commands on Archlinux

2013-04-23 Thread Pierre Gaston
On Wed, Apr 24, 2013 at 7:31 AM, Ilya Basin wrote: > Hi. > > $ cat ~/.bashrc > # > # ~/.bashrc > # > echo Im in .bashrc >&2 > > RHEL 6.0, bash 4.1.2 > $ ssh localhost 'ps -f $$ && true' > Im in .bashrc > UIDPID PPID C STIME TTY STAT TIME CMD >

Re: Re[2]: ~/.bashrc not sourced for ssh commands on Archlinux

2013-04-23 Thread Pierre Gaston
On Wed, Apr 24, 2013 at 9:15 AM, Ilya Basin wrote: > ** > > > > > > > > > > On Wed, Apr 24, 2013 at 7:31 AM, Ilya Basin wrote: > > > Hi. > > > $ cat ~/.bashrc > > # > > # ~/.bashrc > > # > > echo Im in .bashrc >&2 > > > RHEL 6.0, bash 4.1.2 > > $ ssh localhost 'ps -f $$ &

Re: getting weird output out of 'echo' w/args

2013-05-29 Thread Pierre Gaston
On Thu, May 30, 2013 at 4:42 AM, Linda Walsh wrote: > > > Chet Ramey wrote: >> On 5/29/13 9:08 PM, Linda Walsh wrote: >>> Why would I get this: >>> echo "gtk-2.0/2.10.0/engines/liboxygen-gtk.so [u::rwx,u:law:rwx,g::r-x,m::rwx,o::r-x]" >>> gtk-2.0/2.10.0/engines/liboxygen-gtk.so >>> [u:

Re: getting weird output out of 'echo' w/args

2013-05-30 Thread Pierre Gaston
On Thu, May 30, 2013 at 12:04 PM, Davide Brini wrote: > On Thu, 30 May 2013 16:56:36 +0800, Chris Down wrote: > >> Pierre is referring to the fact that [i++] is evaluated as a glob by >> the shell, the reason it doesn't work is because $i is postincremented >> inste

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

2013-06-07 Thread Pierre Gaston
On Fri, Jun 7, 2013 at 3:34 PM, wrote: > Let's say you are running a script that is doing > a loop while ... echo Enter name; read name; .. > > During which the script gets edited on the disk by somebody. > > Well shouldn't bash, when it goes back to the disk to read some next > part of the scrip

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

2013-06-09 Thread Pierre Gaston
On Mon, Jun 10, 2013 at 12:02 AM, Linda Walsh wrote: > I was wondering if I was missing some syntax somewhere... > but I wanted to be able to pass the name of a hash in > and store stuff in it and later retrieve it... but it > looks like it's only possible with an eval or such? > > Would be nice..

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

2013-06-10 Thread Pierre Gaston
On Mon, Jun 10, 2013 at 12:43 PM, Linda Walsh wrote: > > > Pierre Gaston wrote: > >> bash4 has associative arrays: >> >> declare -A array >> array[foobar]=baz >> echo "${array[foobar]}" > > --- > > Right, and bash's name

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

2013-06-10 Thread Pierre Gaston
On Mon, Jun 10, 2013 at 1:37 PM, Pierre Gaston wrote: > On Mon, Jun 10, 2013 at 12:43 PM, Linda Walsh wrote: >> >> >> Pierre Gaston wrote: >> >>> bash4 has associative arrays: >>> >>> declare -A array >>> array[foobar]=baz >>

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

2013-06-14 Thread Pierre Gaston
On Fri, Jun 14, 2013 at 2:25 PM, Dan Douglas wrote: > On Friday, June 14, 2013 06:02:15 AM Dan Douglas wrote: >> On Monday, June 10, 2013 09:39:56 AM Greg Wooledge wrote: >> > > On 10 Jun 2013 14:15, "Chris F.A. Johnson" wrote: >> > > >It is not the least bit difficult with eval: >> > > > >>

Re: Bug report command "cd"

2013-07-03 Thread Pierre Gaston
On Wed, Jul 3, 2013 at 12:52 PM, Stephan van Ingen wrote: > Hello, > > I hope this is the correct way to report a bug (as explained > here > ). > > *The version number of Bash*: 4.2.45(1)-release (x86_64-pc-linux-gnu) > *The ha

Re: Another "set" option?

2013-07-11 Thread Pierre Gaston
On Wed, Jul 10, 2013 at 8:35 PM, Geir Hauge wrote: > 2013/7/10 Bruce Korb > >> This seems like a lot of obtuse bother: >> >> xtrace_setting=$( >>re=$'\nxtrace[ \t]+on' >>[[ $(set -o) =~ $re ]] && echo ' -x' || echo ' +x') >> >> if there were only some magic like ${BASH_SETTING_XTRACE} or

Re: quotes in bash script

2013-07-12 Thread Pierre Gaston
On Fri, Jul 12, 2013 at 9:48 PM, wrote: > I want a script to execute the command: > ls -alst "dir with spaces" > > > The script looks like this : > #! /bin/bash > > PARAMS_FOR_LS="-alst \"dir with spaces\"" > > echo $PARAMS_FOR_LS > > ls $PARAMS_FOR_LS > > > > when I execute the script: > bash -x

Re: Error in read implementation and/or documentation

2013-07-27 Thread Pierre Gaston
On Sat, Jul 27, 2013 at 7:37 AM, Peter Olson wrote: > According to "help read": > Options: > -n nchars return after reading NCHARS characters rather than > waiting > for a newline, but honor a delimiter if fewer than NCHARS > characters are read befo

Re: Error in read implementation and/or documentation

2013-07-27 Thread Pierre Gaston
On Sat, Jul 27, 2013 at 8:11 PM, Peter Olson wrote: > I was using ^D as an EOF. I guess I should have tried it in other ways. Is > ^D not the same as EOF? Sorry if that is a noob question. I was able to > reproduce all of your outputs. I am using xterm as my terminal emulator, if > that matters. >

Re: Bug in function return statement in while subshell

2013-07-29 Thread Pierre Gaston
On Mon, Jul 29, 2013 at 6:06 PM, Chet Ramey wrote: > On 7/29/13 10:55 AM, Roman Rakus wrote: >> I didn't take a look on where the problem could be, but it is discussed on >> stackoverflow [1]. >> >> Looks like return builtin falsely exit execution of while loop instead of >> function. > > What wou

Re: Bug in function return statement in while subshell

2013-07-29 Thread Pierre Gaston
On Mon, Jul 29, 2013 at 6:44 PM, Greg Wooledge wrote: > 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 car

Re: Bug in function return statement in while subshell

2013-07-29 Thread Pierre Gaston
On Mon, Jul 29, 2013 at 7:04 PM, Pierre Gaston wrote: > On Mon, Jul 29, 2013 at 6:44 PM, Greg Wooledge wrote: >> 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

Re: Bug in function return statement in while subshell

2013-07-30 Thread Pierre Gaston
On Mon, Jul 29, 2013 at 8:15 PM, Roman Rakus wrote: > On 07/29/2013 05:06 PM, Chet Ramey wrote: >> >> On 7/29/13 10:55 AM, Roman Rakus wrote: >>> >>> I didn't take a look on where the problem could be, but it is discussed >>> on >>> stackoverflow [1]. >>> >>> Looks like return builtin falsely exit

Re: Bug in function return statement in while subshell

2013-07-30 Thread Pierre Gaston
On Tue, Jul 30, 2013 at 12:29 PM, Chris Down wrote: > On 2013-07-30 12:11, Pierre Gaston wrote: >> what about things like this: foo () ( return 1; ) > > Except in this case, the return has a valid context. I don't see how it's > really > comparable to the repres

Re: Bug in function return statement in while subshell

2013-07-30 Thread Pierre Gaston
On Tue, Jul 30, 2013 at 12:51 PM, Chris Down wrote: > On 2013-07-30 12:45, Pierre Gaston wrote: >> On Tue, Jul 30, 2013 at 12:29 PM, Chris Down wrote: >> > On 2013-07-30 12:11, Pierre Gaston wrote: >> >> what about things like this: foo () ( return 1; ) >> &g

Re: autocomplete error doesn't look to be in bash-complete so I'm reporting it here.

2013-08-16 Thread Pierre Gaston
On Fri, Aug 16, 2013 at 12:28 PM, 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' > -

Re: "jobs" builtin: print zero exit status

2013-09-14 Thread Pierre Gaston
On Sat, Sep 14, 2013 at 3:14 PM, Dmitry Bolshakov wrote: > "wait" blocks, "jobs" - does not > > you can use "if kill -0 $pid;then ..." to see if it's still running, then wait to get the pid

Re: read -t 0 anomaly

2013-10-04 Thread Pierre Gaston
On Fri, Oct 4, 2013 at 2:20 PM, Kunszt Árpád < arpad.kun...@syrius-software.hu> wrote: > I tried to use "read -t 0" to check if there is any data on the STDIN or > not. > > The man page said: > > If timeout is 0, read returns success if input is available on the > specified file descriptor, failur

Re: read -t 0 anomaly

2013-10-04 Thread Pierre Gaston
On Fri, Oct 4, 2013 at 3:08 PM, Kunszt Árpád < arpad.kun...@syrius-software.hu> wrote: > On 2013. October 4. 14:51:00 Pierre Gaston wrote: > > On Fri, Oct 4, 2013 at 2:20 PM, Kunszt Árpád > ... > > > > > > There is a race condition, you cannot know if echo

Re: read -t 0 anomaly

2013-10-04 Thread Pierre Gaston
On Fri, Oct 4, 2013 at 3:29 PM, Pierre Gaston wrote: > > > > On Fri, Oct 4, 2013 at 3:08 PM, Kunszt Árpád < > arpad.kun...@syrius-software.hu> wrote: > >> On 2013. October 4. 14:51:00 Pierre Gaston wrote: >> > On Fri, Oct 4, 2013 at 2:20 PM, Kunszt Árpá

Re: read -t 0 anomaly

2013-10-04 Thread Pierre Gaston
On Fri, Oct 4, 2013 at 3:30 PM, Pierre Gaston wrote: > > > > On Fri, Oct 4, 2013 at 3:29 PM, Pierre Gaston wrote: > >> >> >> >> On Fri, Oct 4, 2013 at 3:08 PM, Kunszt Árpád < >> arpad.kun...@syrius-software.hu> wrote: >> >>> On

Re: read with parameter expansion in here string

2013-11-22 Thread Pierre Gaston
On Fri, Nov 22, 2013 at 4:22 PM, Clint Hepner wrote: > Configuration Information [Automatically generated, do not change]: > Machine: i386 > OS: darwin13.0.0 > Compiler: clang > Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='i386' > -DCONF_OSTYPE='darwin13.0.0' -DCONF_MACHTYPE='i386-apple

Re: RFC: turn off word splitting for vars but keep for read

2013-11-22 Thread Pierre Gaston
On Fri, Nov 22, 2013 at 8:00 AM, Aleksey Midenkov wrote: > Since word splitting in vars is used not more frequently than never, > protecting all vars in scripts with double quotes is quite unpleasant > thing. Therefore, I want exactly this behavior always to be in my > scripts: > > $ IFS="" > $ f

Re: RFC: turn off word splitting for vars but keep for read

2013-11-22 Thread Pierre Gaston
On Fri, Nov 22, 2013 at 8:53 PM, Eric Blake wrote: > On 11/22/2013 10:36 AM, Aleksey Midenkov wrote: > > > But nevertheless, I still find my proposal usable (since word > > splitting for vars is unlikely to be usable in scripts). > > Scripts use word splitting on variables ALL the time. For exam

Re: Feature request for Bash

2013-11-24 Thread Pierre Gaston
On Mon, Nov 25, 2013 at 6:04 AM, Ryan Campbell Cunningham < rvskmbr...@gmail.com> wrote: > Configuration Information [Automatically generated]: > Machine: x86_64 > OS: linux-gnu > Compiler: gcc > Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='x86_64' > -DCONF_OSTYPE='linux-gnu' -DCONF_MACH

Re: Feature request for Bash

2013-11-24 Thread Pierre Gaston
On Mon, Nov 25, 2013 at 9:38 AM, Pierre Gaston wrote: > > > > On Mon, Nov 25, 2013 at 6:04 AM, Ryan Campbell Cunningham < > rvskmbr...@gmail.com> wrote: > >> Configuration Information [Automatically generated]: >> Machine: x86_64 >> OS: linux-gnu >>

Re: continuously evaluated prompts/environmental variables

2013-11-26 Thread Pierre Gaston
On Tue, Nov 26, 2013 at 7:21 AM, Edward Peschko wrote: > All, > > I was wondering if there was a way to make an environmental variable > be evaluated each time it was accessed. In other words, with: > > export PS1="`whoami`@`hostname`" > > This works for the first time that the prompt is evaluate

Re: failure to install bash in Zorin-os system

2013-12-05 Thread Pierre Gaston
On Thu, Dec 5, 2013 at 8:37 AM, Jianfeng Menglu wrote: > I am installing Bash into zorin-os system. According to install > instruction, I have successfully passed "configuration", "make' and "make > tests". When I typed "make install", to install, the following message come > up and the installati

Re: bug: incorrect variable values when reading from file with 0d0a as newlines

2013-12-17 Thread Pierre Gaston
On Tue, Dec 17, 2013 at 3:18 PM, Sergey Skripnick 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

Re: multi-line alias executed out of order

2013-12-17 Thread Pierre Gaston
On Tue, Dec 17, 2013 at 6:33 AM, Andrew Martin wrote: > Configuration Information [Automatically generated, do not > change]:Machine: x86_64OS: linux-gnuCompiler: gccCompilation CFLAGS: > -DPROGRAM='bash' -DCONF_HOSTTYPE='x86_64' -DCONF_OSTYPE='linux-gnu' > -DCONF_MACHTYPE='x86_64-pc-linux-gnu' -

Re: I think bash logic in a loop like : while [ condition] |read somevar is flawed.

2013-12-23 Thread Pierre Gaston
On Tue, Dec 24, 2013 at 12:57 AM, rens wrote: > > Subject: [50 character or so descriptive subject here (for reference)] > > Configuration Information [Automatically generated, do not change]: > Machine: x86_64 > OS: linux-gnu > Compiler: gcc -I/home/abuild/rpmbuild/BUILD/bash-4.2 > -L/home/abuil

Re: I think bash logic in a loop like : while [ condition] |read somevar is flawed.

2013-12-24 Thread Pierre Gaston
On Tue, Dec 24, 2013 at 8:56 PM, Greg Wooledge wrote: > On Tue, Dec 24, 2013 at 07:49:28PM +0100, rens wrote: > > I understand the technical origin of the behaviour. > > Spend +25 yrs in unix. I am so old, that I remember fighting (at my > > 40th) with linux 0.79, I think > > > > However, I

bash exiting session, command substitution, command_not_found_handle

2013-12-28 Thread Pierre Gaston
(from #bash on freenode) Running a command that is not found in the background with a handler using command substitution kills the shell, or the whole session. Here is a test case: $ ( bash -ci 'command_not_found_handle () { printf "$(true)"; }; nonexistingcommand &') [1] 4696 $ bash: child setp

Re: bash exiting session, command substitution, command_not_found_handle

2013-12-28 Thread Pierre Gaston
On Sat, Dec 28, 2013 at 7:32 PM, Pierre Gaston wrote: > (from #bash on freenode) > > Running a command that is not found in the background with a handler > using command substitution kills the shell, or the whole session. > > Here is a test case: > > $ ( bash -ci &

Re: Positional parameter & array slicing bug with empty arguments

2014-01-11 Thread Pierre Gaston
On Sun, Jan 12, 2014 at 3:11 AM, Theodoros V. Kalamatianos wrote: > Hi, > > I have bumped into a rather strange issue: > > $ set -- ''; printf "=%s=\n" "$@" x > == > =x= > $ set -- ''; printf "=%s=\n" "${@:1}" x > =x= > > Notice how in the second version the empty positional parameter is no > lon

Re: let's establish BASH_MINIMUM_TIME_BETWEEN_INTERACTIVE_COMMAND

2014-01-30 Thread Pierre Gaston
On Thu, Jan 30, 2014 at 12:37 PM, Dan Jacobson wrote: > Thanks fellows but now bash has become very slow to the touch that way. > Maybe try something like: PROMPT_COMMAND='read -t0 && sleep 10'

Re: let's establish BASH_MINIMUM_TIME_BETWEEN_INTERACTIVE_COMMAND

2014-01-30 Thread Pierre Gaston
On Thu, Jan 30, 2014 at 12:56 PM, Dan Jacobson wrote: > >>>>> "PG" == Pierre Gaston writes: > PG> Maybe try something like: PROMPT_COMMAND='read -t0 && sleep 10' > > But how will that on its own stop me from dumping tons of lines of j

Re: Segmentation fault when -x is added and variable contains nulls

2014-02-06 Thread Pierre Gaston
On Thu, Feb 6, 2014 at 3:38 PM, Chet Ramey wrote: > On 2/5/14 10:51 PM, Dan Jacobson wrote: > > # su - nobody > > No directory, logging in with HOME=/ > > $ cat /tmp/r > > LC_CTYPE=zh_TW.UTF-8 N=$(echo 統一|iconv -t big5 -f utf-8) sh -xc ': $N' > > $ sh /tmp/r > > /tmp/r: line 1: 4551 Segmentation

Re: Segmentation fault when -x is added and variable contains nulls

2014-02-06 Thread Pierre Gaston
On Thu, Feb 6, 2014 at 4:07 PM, Pierre Gaston wrote: > > > > On Thu, Feb 6, 2014 at 3:38 PM, Chet Ramey wrote: > >> On 2/5/14 10:51 PM, Dan Jacobson wrote: >> > # su - nobody >> > No directory, logging in with HOME=/ >> > $ cat /tmp/r >> >

Re: Please accept M-p as well as C-p

2014-02-13 Thread Pierre Gaston
On Thu, Feb 13, 2014 at 1:35 PM, Ed Avis wrote: > Bash accepts the Emacs keybinding C-p to go back in the history, and C-n > to go forward. > But most of the time in Emacs (when using its minibuffer) the keys you use > are Meta-p > and Meta-n, or on a modern PC keyboard Alt-p and Alt-n. > > Curre

Re: Top does not handle more than 100 cores

2014-03-24 Thread Pierre Gaston
On Mon, Mar 24, 2014 at 12:08 PM, Alexandre De Champeaux 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_

Re: Special built-ins not persisting assignments

2014-03-24 Thread Pierre Gaston
On Tue, Mar 25, 2014 at 2:39 AM, Pollock, Wayne wrote: > $ echo $BASH_VERSION > 4.2.45(1)-release > > $ unset foo > > $ foo=bar : > > $ echo $foo > > > $ > > === > > According to POSIX/SUS issue 7, assignments for special builtins > should persist. So the output should be ``bar''. >

Re: easier construction of arrays

2014-03-27 Thread Pierre Gaston
On Thu, Mar 27, 2014 at 5:53 PM, Mike Frysinger wrote: > On Thu 27 Mar 2014 08:01:45 Greg Wooledge wrote: > > files=() > > while IFS= read -r -d '' file; do > > files+=("$file") > > done < <(find . -iname '*.mp3' ! -iname '*abba*' -print0) > > i've seen this construct duplicated so many times :

Re: /dev/fd/62: No such file or directory

2014-04-01 Thread Pierre Gaston
On Wed, Apr 2, 2014 at 6:04 AM, Linda Walsh wrote: > > > Greg Wooledge wrote: > >> On Fri, Mar 28, 2014 at 06:14:27PM -0700, Linda Walsh wrote: >> >>> Does read varname <<<$(...) use process substitution? >>> >> >> I wouldn't dare write it like that, because who knows how the parser >> will treat

Re: /dev/fd/62: No such file or directory

2014-04-05 Thread Pierre Gaston
mp;& return 0 >>> >>> --- the $1 doesn't need quotes in [[]] and '*' won't expand or >>> am missing something? Thanks for the tip Pierre, I often >>> don't see forests because of all the trees... >>> >> >> Th

Re: jobs -p falsely reports the last background pid

2014-04-09 Thread Pierre Gaston
On Wed, Apr 9, 2014 at 3:16 PM, Håkon Bugge wrote: > > On 9. apr. 2014, at 14.04, Greg Wooledge wrote: > > > On Wed, Apr 09, 2014 at 12:43:40PM +0200, Håkon Bugge wrote: > >> This script never terminates: > >> -- > >> #!/bin/bash > >> > >> for P in

Re: jobs -p falsely reports the last background pid

2014-04-09 Thread Pierre Gaston
On Wed, Apr 9, 2014 at 3:28 PM, Greg Wooledge wrote: > On Wed, Apr 09, 2014 at 02:16:22PM +0200, Håkon Bugge wrote: > > That is not the issue. Try it out. > > Very well. I can confirm that this script does not terminate on HP-UX > 10.20 under bash 4.3.8: > > #!/bin/bash > set -m > for x in 1 2 3

Re: Command name dequote does not work

2014-04-15 Thread Pierre Gaston
On Tue, Apr 15, 2014 at 10:32 AM, 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' > -DC

couple of bugs

2014-04-29 Thread Pierre Gaston
A couple of 4.3 bugs have surfaced on IRC, I'm not sure they are reported here, so just in case here they are 1) bash gets stuck shopt -s extglob echo !(*/) # never returns, cannot be interrupted 2) $0 is not always expanded: echo "without \$1 ${@:0:1}";set -- one;echo "with \$1 ${@:0:1}" witho

Re: winch trap delayed until keypress

2014-05-22 Thread Pierre Gaston
On Thu, May 22, 2014 at 8:16 AM, Linda Walsh wrote: > > > Chet Ramey wrote: > >> On 5/20/14, 8:28 AM, Egmont Koblinger wrote: >> >>> Hi, >>> >>> Execute this in an interactive bash and then resize the window: >>> trap 'stty size' winch >>> >>> In bash-4.2, the trap was executed immediately upon r

Re: winch trap delayed until keypress

2014-05-22 Thread Pierre Gaston
On Thu, May 22, 2014 at 4:02 PM, Linda Walsh wrote: > > > Pierre Gaston wrote: > >> >> As I understand it, this is now broken in 4.3?: >> >> # display new size of terminal when resized >> function showsize () {\ >> loca

Re: Bind builtin does not run readline commands

2014-05-27 Thread Pierre Gaston
On Tue, May 27, 2014 at 8:19 AM, wrote: > Configuration Information [Automatically generated, do not change]: > Machine: x86_64 > OS: linux-gnu > Compiler: x86_64-pc-linux-gnu-gcc > Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='x86_64' > -DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='x86_64-

Arithmetic + array allows for code injection

2014-05-30 Thread Pierre Gaston
It doesn't seem right for code looking as innocent as $((a[$i])) or $((a["$i"])) to allow running arbitrary commands for some value of i, that are no even that clever: $ i='$( echo >&2 an arbitrary command )';: $((a["$i"])) an arbitrary command $ i='"$( echo >&2 an arbitrary command)"';: $((a[$i

Re: Arithmetic + array allows for code injection

2014-05-30 Thread Pierre Gaston
On Fri, May 30, 2014 at 9:08 PM, Greg Wooledge wrote: > On Fri, May 30, 2014 at 08:57:42PM +0300, Pierre Gaston wrote: > > It doesn't seem right for code looking as innocent as $((a[$i])) or > > $((a["$i"])) to allow running arbitrary commands for some value of

Re: Arithmetic + array allows for code injection

2014-06-02 Thread Pierre Gaston
On Mon, Jun 2, 2014 at 4:44 PM, Chet Ramey wrote: > On 6/2/14, 8:21 AM, Greg Wooledge wrote: > > On Fri, May 30, 2014 at 09:28:13PM -0500, Dan Douglas wrote: > >> The problem is most people don't realize how "variables" are evaluated. > >> Any time the shell needs to reference a variable, it take

Re: Some kind of file descriptor overflow

2014-06-13 Thread Pierre Gaston
On Fri, Jun 13, 2014 at 9:56 PM, Jorge Sivil wrote: > Yes, sorry. The minimum reproduceable code is: > > #!/bin/bash > function something() { > while true > do > while read VAR > do > dummyvar="a" > done < <(find "/run/shm/debora" -type f | sort) > sleep 3 > done > } >

Re: Difference between assignment via nameref vs `printf -v`?

2014-08-31 Thread Pierre Gaston
On Sun, Aug 31, 2014 at 7:19 PM, lolilolicon wrote: > On Sun, Aug 31, 2014 at 12:20 PM, lolilolicon > wrote: > > Assignment to a subscripted array variable behaves differently for > > nameref vs `printf -v`, as shown below. > > > > Assignment via nameref variable: > > > > declare -a arr=() > > f

Re: Issues with exported functions

2014-09-25 Thread Pierre Gaston
On Thu, Sep 25, 2014 at 11:06 AM, lolilolicon wrote: > On Thu, Sep 25, 2014 at 9:35 AM, Chet Ramey wrote: > > On 9/24/14, 3:44 PM, lolilolicon wrote: > > > >> Personally, I have never needed this feature. I would vote for its > >> removal: It's very surprising, creates bugs, and is not very usef

Re: Issues with exported functions

2014-09-25 Thread Pierre Gaston
On Thu, Sep 25, 2014 at 12:42 PM, lolilolicon wrote: > On Thu, Sep 25, 2014 at 7:19 AM, Linda Walsh wrote: > > lolilolicon wrote: > >> > >> I don't expect more than a dozen who rely on this... but bash > >> programmers can be quite the perverts, so... > >> > > > > Personally I find those who don

Re: Issues with exported functions

2014-09-25 Thread Pierre Gaston
On Thu, Sep 25, 2014 at 1:04 PM, lolilolicon wrote: > On Thu, Sep 25, 2014 at 5:51 PM, Pierre Gaston > wrote: > > > > > > On Thu, Sep 25, 2014 at 12:42 PM, lolilolicon > wrote: > >> > >> On Thu, Sep 25, 2014 at 7:19 AM, Linda Walsh wrote: >

#include is missing in examples/loadable/truefalse.c

2007-07-23 Thread Pierre Gaston
#include is missing from truefalse.c in examples/loadables and its compilation fails with ./configure and make. Not a big deal, just to let you know. Thanks. Pierre ___ Bug-bash mailing list Bug-bash@gnu.org http://lists.gnu.org/mailman/listinfo

Re: Help with script --

2007-08-27 Thread Pierre Gaston
On 8/28/07, t0nedef <[EMAIL PROTECTED]> wrote: > > > WORK_PATH=/etc/wpa_helper # Storage directory DO NOT MODIFY > WORK_FILE=$WORKPATH/$ESSID.conf # Configuration file DO NOT MODIFY > if [ ! -e $WORKPATH ] > if [ ! -e $WORKFILE ] also you use WORK_PATH WORKPATH WORKFILE WORK_FILE

Re: Help with script --

2007-08-27 Thread Pierre Gaston
On 8/28/07, t0nedef <[EMAIL PROTECTED]> wrote: > > Ok, i wrote this script to help with wpa wireless connections, but for some > reason, it errors out. It says that the ESSID is empty. I've double checked > my syntax, and it looks right to me. *yes, i did double check the syntax for > the read comm

Re: -d option not working. . .?

2007-09-12 Thread Pierre Gaston
On 9/12/07, Michael Williams <[EMAIL PROTECTED]> wrote: > Forgive me for saying so, and please appreciate both the sarcasm and > irony, but I've never been one for "that's the way it's always > been". I mean, if we all thought that way, we'd be a bunch of > bloodletting flat-earthers. . .no? ;)

Re: CDPATH bug

2007-10-01 Thread Pierre Gaston
fail if no valid directory name can be constructed from any of the entries in `$CDPATH', even if the a directory with the same name as the name given as an argument to `cd' exists in the current directory. Pierre

Re: CDPATH bug

2007-10-01 Thread Pierre Gaston
On 10/1/07, Valkanas Nikos <[EMAIL PROTECTED]> wrote: > > Dear Pierre, > > I am afraid you didn't understand my problem. I think I did, if bash is invoked as sh, it behaves differently, one of these differences is that cd will not try to search in you current directory. a

Re: CDPATH bug

2007-10-02 Thread Pierre Gaston
On 10/2/07, Valkanas Nikos <[EMAIL PROTECTED]> wrote: > Sorry for butting in. Considering that "Desktop" is a valid subdir is it > normal behavior in *any* shell to get: > > DrWho:~-> cd Desktop > sh: cd: Desktop: No such file or directory > > Which shell behaves like that? Chet Ramey listed some

Re: regexp matching broken in bash-3.2.x?

2007-10-27 Thread Pierre Gaston
On 10/27/07, Bernd Eggink <[EMAIL PROTECTED]> wrote: > Pavel Gorshkov schrieb: > > > Description: > > Regexp matching seems to be broken since 3.2.0. > > Repeat-By: > > The following used to work in bash-3.1: > > $ [[ test =~ 't.*t' ]]; echo $? > > 1 > > It works without the quo

Re: is this a bug?

2007-11-14 Thread Pierre Gaston
On Nov 14, 2007 7:26 AM, naruto canada <[EMAIL PROTECTED]> wrote: > function fact { > local n=$1 > if [ "$n" -eq 0 ]; then > return 1 > else > fact $(( $n - 1 )) > return $(( $n * $? )) > fi > } > > for i in `seq 0 11`; do > fact $i ; echo $? > done > > > 1 > 1 > 2 > 6 > 24 > 12

Re: read doesn't work with piped stdin

2007-11-19 Thread Pierre Gaston
> Description: > read silently fails when stdin is piped to it. -u switch does not > help. > Redirection works fine. > This and your other bug result from the fact that the commands in the pipe run in subshells. echo foo | read # doesn't work because a subshell cannot modify the pa

Re: reading whitespaces and beginning and end of line

2007-12-07 Thread Pierre Gaston
On Dec 7, 2007 12:49 PM, sancho1980 <[EMAIL PROTECTED]> wrote: > The problem I have occurs whenever there is a whitespace at the end of a > line in the input file, because this whitespace get automatically truncated > from "$line", and i dont want that..i want the whole line to go into > outfile,

Re: bug kde kubuntu v7.10

2008-01-07 Thread Pierre Gaston
Bonjour, Cependant ce mail semble assez hors sujet sur cette liste, adresse toi plutôt à une liste concernant kubuntu, ou envoie un e-mail au maintainer d'adept pour kubuntu. Pierre. On Jan 7, 2008 11:12 PM, sibelius <[EMAIL PROTECTED]> wrote: > Bonjour, > de Fr

Re: Comparison failure

2008-01-10 Thread Pierre Gaston
On Jan 10, 2008 3:13 PM, Frans de Boer <[EMAIL PROTECTED]> wrote: > To: bug-bash@gnu.org > Subject: Comparison failure > > Following is a function which fails constantly. The function is being > called by other functions but the result is nowadays always this failure > on the compare function. Some

Re: -e does not work with subscript

2008-01-28 Thread Pierre Gaston
On Jan 28, 2008 11:36 PM, <[EMAIL PROTECTED]> 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'

Re: capturing sub-expressions?

2008-01-28 Thread Pierre Gaston
On Jan 28, 2008 4:00 AM, Linda Walsh <[EMAIL PROTECTED]> wrote: > I was wondering -- in the bash substitute commands ${..%%|##|//} etc, > is there a way to "capture" a subexpression, so that I can > use the subexpression in the replacement string so I can > end up 'only' with the the subexpression?

Re: -e does not work with subscript

2008-01-28 Thread Pierre Gaston
On Jan 29, 2008 9:32 AM, 龙海涛 <[EMAIL PROTECTED]> wrote: > > > $ bash -ce '(false;echo foo);echo bar' > > bar > could i ask what the command line option '-e' mean? > i did not find any explanation in bash's manual. It has the same effect as set -e, you can pass the options of set to bash directly b

Re: -e does not work with subscript

2008-01-29 Thread Pierre Gaston
On Jan 29, 2008 10:04 AM, Stepan Koltsov <[EMAIL PROTECTED]> wrote: > > Bash must exit the shell too. Because > > $ bash -ce '(false); echo $?' > 1 > > S. > (false) is a compound command, the bash exits with set -e only if a simple command exits with false

Re: -e does not work with subscript

2008-01-29 Thread Pierre Gaston
On Jan 29, 2008 8:09 PM, Stepan Koltsov <[EMAIL PROTECTED]> wrote: > What is "simple command"? > > Is > > === > ( false ) || false > === > > simple? Seems like it is not, however > > === > set -e > > ( false ) || false > > echo "end" > === > > Prints nothing and exits with error. Indeed according

Re: Add a new internal command to BASH

2008-05-23 Thread Pierre Gaston
On Fri, May 23, 2008 at 5:56 AM, Abhinandan <[EMAIL PROTECTED]> wrote: > > Hi, > thats not what i intend to do. I want to write my own command and compile > the bash source and then run that command as bash built in command > Have a look at the bash source code tarball, you will find several examp

Re: minimal expression

2008-06-15 Thread Pierre Gaston
On Sat, Jun 14, 2008 at 11:57 AM, xaviermasr <[EMAIL PROTECTED]> wrote: > > Hi all, > > I'm starting to use bash programming and I'd like to know if it can use > minimal expressions (.*?) as in Perl. 'sed' command can use them, but I > think isn't possible within bash commands (as ingrep manipulati

Re: [[ ... =~ ... ]] is broken when RHS is quoted

2008-06-22 Thread Pierre Gaston
On Sun, Jun 22, 2008 at 12:07 PM, Alexis Huxley <[EMAIL PROTECTED]> 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_MACHTYP

Re: [[ ... =~ ... ]] is broken when RHS is quoted

2008-06-22 Thread Pierre Gaston
On Sun, Jun 22, 2008 at 8:15 PM, Alexis Huxley <[EMAIL PROTECTED]> wrote: >> > Description: >> >[[ ... =~ ... ]] is broken when RHS is quoted >> >> from http://tiswww.case.edu/php/chet/bash/CHANGES : >> >> f. Quoting the string argument to the [[ command's =~ operator now forces >> st

Re: some variable level issues

2008-07-01 Thread Pierre Gaston
2008/7/1 pk <[EMAIL PROTECTED]>: > On Tuesday 1 July 2008 05:22, Chris F.A. Johnson wrote: > >> var=${var%.} > > ITYM > > var=${var%' > .'} that would defeat the purpose of keeping the trailing newlines of file, and would just be wrong if the file doesn't have a trailing newline

Re: Variable scoping

2008-07-24 Thread Pierre Gaston
On Fri, Jul 25, 2008 at 2:07 AM, Dan Stromberg <[EMAIL PROTECTED]> wrote: > > Having a shell function's variable changes reflected in its caller really > kinda makes me shudder - in fact, it reminds me of gosub. It seems like > a bug waiting to happen; I'm amazed I haven't been bitten by it yet. >

Re: query regarding Bash

2008-08-04 Thread Pierre Gaston
On Mon, Aug 4, 2008 at 2:30 PM, Roli Srivastava <[EMAIL PROTECTED]> wrote: > Hello sir, ... > 1. In which language the GNU shell (bash) has been written? (I >have read that bourne and korn use the ALGOL and C etc., but I am >not able to get any information about bash) The syntax, in

Re: export arrays does not work. not documented as not working

2008-08-14 Thread Pierre Gaston
It's listed in the BUGS section of my man page (last line of the page): "Array variables may not (yet) be exported."

Re: edit-and-execute-command (C-xC-e) doesn't use FCEDIT env variable

2008-08-24 Thread Pierre Gaston
On Sat, 23 Aug 2008, Francis Moreau wrote: I think I won't use VISUAL but start emacs in sh-mode if the file name argument matches "*bash-fc-*" pattern. It should be safe. adding the following in your .emacs should do the trick: (add-to-list 'auto-mode-alist '("^/tmp/bash-fc" . sh-mode))

Re: Equivalent of ksh, zsh {N}<[WORD] ?

2008-08-26 Thread Pierre Gaston
On Tue, Aug 26, 2008 at 5:41 AM, R. Bernstein <[EMAIL PROTECTED]> wrote: > Both zsh and ksh have a way to open a file or duplicate a file > descriptor and let the interpreter pick the descriptor saving the > newly-allocated file descriptor number in a variable. In particular: > > exec {fd}<&0 > >

Re: Equivalent of ksh, zsh {N}<[WORD] ?

2008-08-26 Thread Pierre Gaston
On Tue, Aug 26, 2008 at 4:49 PM, R. Bernstein <[EMAIL PROTECTED]> wrote: > Pierre Gaston writes: > > On Tue, Aug 26, 2008 at 5:41 AM, R. Bernstein <[EMAIL PROTECTED]> wrote: > > > Both zsh and ksh have a way to open a file or duplicate a file > > > desc

<    1   2   3   4   >