From MAILER-DAEMON Tue Jan 01 17:23:34 2008 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1J9pWI-00080Z-98 for mharc-bug-bash@gnu.org; Tue, 01 Jan 2008 17:23:34 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1J9pWH-0007zQ-5V for bug-bash@gnu.org; Tue, 01 Jan 2008 17:23:33 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1J9pWG-0007yE-Ev for bug-bash@gnu.org; Tue, 01 Jan 2008 17:23:32 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1J9pWG-0007xw-2o for bug-bash@gnu.org; Tue, 01 Jan 2008 17:23:32 -0500 Received: from lax-green-bigip-5.dreamhost.com ([208.113.200.5] helo=blingymail-a1.g.dreamhost.com) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1J9pWF-0005Yw-Tl for bug-bash@gnu.org; Tue, 01 Jan 2008 17:23:32 -0500 Received: from jidanni1 (122-127-32-223.dynamic.hinet.net [122.127.32.223]) by blingymail-a1.g.dreamhost.com (Postfix) with ESMTP id 9694B5CE76 for ; Tue, 1 Jan 2008 14:23:28 -0800 (PST) To: bug-bash@gnu.org From: jidanni@jidanni.org Date: Wed, 02 Jan 2008 06:23:16 +0800 Message-ID: <87ir2d9odn.fsf@jidanni.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-detected-kernel: by monty-python.gnu.org: Linux 2.4-2.6 Subject: ESC . vs. ^R, ^P again X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Jan 2008 22:23:33 -0000 As there years pass I use ESC . daily hoping that it will get the last chunk of the previous line on my screen, despite any ^P's or ^R's I might have done. Never have I wanted it to consider those ^P's and ^R's. So even though you said that was a early design choice, perhaps you could still leave (behind for posterity) a toggle variable or new binding to do my dumber mode. My http://www.useit.com/alertbox/ style survey of many years with hundreds of hours with, er, 1 user, "indicates", as they say in the medical business, that this is needed. Surely you (all) are not such constant hammerers of ESC . as I. Vote for Choice. From MAILER-DAEMON Wed Jan 02 04:25:39 2008 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1J9zr0-0003Kc-Tk for mharc-bug-bash@gnu.org; Wed, 02 Jan 2008 04:25:38 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1J9zqz-0003HT-Hq for bug-bash@gnu.org; Wed, 02 Jan 2008 04:25:37 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1J9zqx-0003Cq-9W for Bug-bash@gnu.org; Wed, 02 Jan 2008 04:25:36 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1J9zqx-0003CZ-2p for Bug-bash@gnu.org; Wed, 02 Jan 2008 04:25:35 -0500 Received: from kuber.nabble.com ([216.139.236.158]) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1J9zqw-0005SP-Ko for Bug-bash@gnu.org; Wed, 02 Jan 2008 04:25:34 -0500 Received: from isper.nabble.com ([192.168.236.156]) by kuber.nabble.com with esmtp (Exim 4.63) (envelope-from ) id 1J9zqu-0003tT-Fo for Bug-bash@gnu.org; Wed, 02 Jan 2008 01:25:32 -0800 Message-ID: <14575394.post@talk.nabble.com> Date: Wed, 2 Jan 2008 01:25:32 -0800 (PST) From: Matthew_S To: Bug-bash@gnu.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Nabble-From: M_Sleaford@hotmail.com X-detected-kernel: by monty-python.gnu.org: Linux 2.6 (newer, 3) Cc: Subject: Taking input line by line from a config file in Bash X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Jan 2008 09:25:37 -0000 Hi all and firstly=E2=80=A6 Happy New Year! It wouldn=E2=80=99t be a New Year without a New Problem though ;-) I=E2=80=99m trying to create a script that will take the input of a config = file line by line. Unfortunately, what seems to be happening is that it is taking it though word by word instead? For arguments sake I=E2=80=99ve put =E2=80=98I want this whole line on one = line=E2=80=99 into the config file and the script looks like this; for i in `cat config.txt` do echo $i echo >> $RESULTS echo $i >> $RESULTS $i [ $? =3D=3D 0 ] && echo "PASSED" >> $RESULTS || echo "FAILED" >> $RESULTS Done And here are the results; I ./filesystem_test.sh: line 12: I: command not found want ./filesystem_test.sh: line 12: want: command not found this ./filesystem_test.sh: line 12: this: command not found whole ./filesystem_test.sh: line 12: whole: command not found line ./filesystem_test.sh: line 12: line: command not found on ./filesystem_test.sh: line 12: on: command not found one ./filesystem_test.sh: line 12: one: command not found line ./filesystem_test.sh: line 12: line: command not found It=E2=80=99s been suggested that I try read and so I have this; File=3D./config.txt { read line echo $i echo >> $RESULTS echo $i >> $RESULTS $i [ $? =3D=3D 0 ] && echo "PASSED" >> $RESULTS || echo "FAILED" >> $RESULTS } < $File But need to get the numbered input from by using cat -n on the config file, but the space delimiter in cut doesn=E2=80=99t seem to allow me to select o= nly the numbers? Which means I can=E2=80=99t run something like; for i in `cat -n config.txt | cut -d' ' -f1 =09do read line $i =09etc=E2=80=A6 Any help or guidance would be greatly appreciated. Many thanks. Matthew. --=20 View this message in context: http://www.nabble.com/Taking-input-line-by-li= ne-from-a-config-file-in-Bash-tp14575394p14575394.html Sent from the Gnu - Bash mailing list archive at Nabble.com. From MAILER-DAEMON Wed Jan 02 04:36:36 2008 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1JA01c-000531-0a for mharc-bug-bash@gnu.org; Wed, 02 Jan 2008 04:36:36 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JA01a-00052t-38 for bug-bash@gnu.org; Wed, 02 Jan 2008 04:36:34 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JA01Z-00052h-2q for Bug-bash@gnu.org; Wed, 02 Jan 2008 04:36:33 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JA01Y-00052e-Vy for Bug-bash@gnu.org; Wed, 02 Jan 2008 04:36:33 -0500 Received: from joseki.proulx.com ([216.17.153.58]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JA01Y-0007Lr-La for Bug-bash@gnu.org; Wed, 02 Jan 2008 04:36:32 -0500 Received: from dementia.proulx.com (dementia.proulx.com [192.168.1.115]) by joseki.proulx.com (Postfix) with ESMTP id F2891FA68; Wed, 2 Jan 2008 02:36:30 -0700 (MST) Received: by dementia.proulx.com (Postfix, from userid 1000) id CF8F63CC633; Wed, 2 Jan 2008 02:36:30 -0700 (MST) Date: Wed, 2 Jan 2008 02:36:30 -0700 To: Matthew_S Message-ID: <20080102093630.GA19813@dementia.proulx.com> Mail-Followup-To: Matthew_S , Bug-bash@gnu.org References: <14575394.post@talk.nabble.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <14575394.post@talk.nabble.com> User-Agent: Mutt/1.5.13 (2006-08-11) From: bob@proulx.com (Bob Proulx) Content-Transfer-Encoding: quoted-printable X-detected-kernel: by monty-python.gnu.org: Genre and OS details not recognized. Cc: Bug-bash@gnu.org Subject: Re: Taking input line by line from a config file in Bash X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Jan 2008 09:36:34 -0000 Matthew_S wrote: > For arguments sake I=E2=80=99ve put =E2=80=98I want this whole line on = one line=E2=80=99 into the > config file and the script looks like this; >=20 > for i in `cat config.txt` The result of this will be split on words. That is not what you want. > It=E2=80=99s been suggested that I try read and so I have this; Yes. Read would be quite a better way to do it. > File=3D./config.txt >=20 > { > read line > echo $i > echo >> $RESULTS > echo $i >> $RESULTS > $i > [ $? =3D=3D 0 ] && echo "PASSED" >> $RESULTS || echo "FAILED" >= > > $RESULTS > } < $File That above makes no sense to me. Try something more like this: while read line ; do echo "$line" done < config.txt > But need to get the numbered input from by using cat -n on the config f= ile, Can you simply keep track of the line numbers yourself as you go along? lineno=3D0 while read line ; do lineno=3D$(($lineno + 1)) echo "$lineno: $line" done < config.txt Bob From MAILER-DAEMON Wed Jan 02 05:02:42 2008 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1JA0Qs-0005RA-9V for mharc-bug-bash@gnu.org; Wed, 02 Jan 2008 05:02:42 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JA0Qo-0005OW-IP for bug-bash@gnu.org; Wed, 02 Jan 2008 05:02:38 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JA0Qh-0005K1-Ab for Bug-bash@gnu.org; Wed, 02 Jan 2008 05:02:36 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JA0Qf-0005Ip-FI for Bug-bash@gnu.org; Wed, 02 Jan 2008 05:02:29 -0500 Received: from kuber.nabble.com ([216.139.236.158]) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1JA0Qe-0003Jc-CN for Bug-bash@gnu.org; Wed, 02 Jan 2008 05:02:28 -0500 Received: from isper.nabble.com ([192.168.236.156]) by kuber.nabble.com with esmtp (Exim 4.63) (envelope-from ) id 1JA0Qc-0004zJ-I4 for Bug-bash@gnu.org; Wed, 02 Jan 2008 02:02:26 -0800 Message-ID: <14575880.post@talk.nabble.com> Date: Wed, 2 Jan 2008 02:02:26 -0800 (PST) From: Matthew_S To: Bug-bash@gnu.org In-Reply-To: <20080102093630.GA19813@dementia.proulx.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Nabble-From: M_Sleaford@hotmail.com References: <14575394.post@talk.nabble.com> <20080102093630.GA19813@dementia.proulx.com> X-detected-kernel: by monty-python.gnu.org: Linux 2.6 (newer, 3) Cc: Subject: Re: Taking input line by line from a config file in Bash X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Jan 2008 10:02:39 -0000 Hi Bob, Thanks for the quick reply. With the 'while read line', it appears that I don't need to keep track of the line numbers. In fact this below does exactly what I need it to do; cat $File | # Supply input from a file while read line # As you suggested... do echo $line echo >> $RESULTS echo $line >> $RESULTS $line [ $? == 0 ] && echo "PASSED" >> $RESULTS || echo "FAILED" >> $RESULTS done exit Thanks again. Matthew. -- View this message in context: http://www.nabble.com/Taking-input-line-by-line-from-a-config-file-in-Bash-tp14575394p14575880.html Sent from the Gnu - Bash mailing list archive at Nabble.com. From MAILER-DAEMON Wed Jan 02 08:45:38 2008 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1JA3uc-0006W9-44 for mharc-bug-bash@gnu.org; Wed, 02 Jan 2008 08:45:38 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JA3ua-0006W4-L7 for bug-bash@gnu.org; Wed, 02 Jan 2008 08:45:36 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JA3uY-0006Vs-5P for bug-bash@gnu.org; Wed, 02 Jan 2008 08:45:35 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JA3uX-0006Vp-VE for bug-bash@gnu.org; Wed, 02 Jan 2008 08:45:33 -0500 Received: from mpv3.tis.cwru.edu ([129.22.105.35]) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_3DES_EDE_CBC_SHA1:24) (Exim 4.60) (envelope-from ) id 1JA3uX-0007nE-Oy for bug-bash@gnu.org; Wed, 02 Jan 2008 08:45:33 -0500 Received: from mpv6.TIS.cwru.edu (mpv6.TIS.CWRU.Edu [129.22.104.221]) by mpv3.TIS.cwru.edu (MOS 3.8.6-GA) with ESMTP id CBA74512 for ; Wed, 2 Jan 2008 08:45:31 -0500 (EST) Received: from caleb.ins.cwru.edu (caleb.INS.CWRU.Edu [129.22.8.211]) by mpv6.TIS.cwru.edu (MOS 3.8.6-GA) with SMTP id DON36675; Wed, 2 Jan 2008 08:45:29 -0500 (EST) Date: Wed, 2 Jan 2008 08:44:59 -0500 From: Chet Ramey Sender: Chet Ramey To: bug-bash@gnu.org Message-ID: <080102134459.AA00834.SM@caleb.ins.cwru.edu> Read-Receipt-To: chet.ramey@case.edu MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Junkmail-Status: score=10/49, host=mpv3.cwru.edu X-Junkmail-SD-Raw: score=unknown, refid=str=0001.0A090201.477B957B.00CC,ss=1,fgs=0, ip=129.22.104.221, so=2007-10-30 19:00:17, dmn=5.4.3/2007-11-16 X-Junkmail-IWF: false X-detected-kernel: by monty-python.gnu.org: Genre and OS details not recognized. Cc: chet@case.edu Subject: Bash-3.2 Official Patch 26 X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: chet.ramey@case.edu List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Jan 2008 13:45:36 -0000 BASH PATCH REPORT ================= Bash-Release: 3.2 Patch-ID: bash32-026 Bug-Reported-by: Chet Ramey Bug-Reference-ID: Bug-Reference-URL: Bug-Description: This keeps the Apple linker from attempting to link bash against Apple's readline library "replacement" rather than the one shipped with bash. It extends the configure workaround to Mac OS X Leopard (10.5). As a side effect, the patch updates the copyright date displayed in the version string. You must re-run configure after applying the patch, and before rebuilding bash. Patch: *** ../bash-3.2-patched/configure.in 2007-03-06 11:07:38.000000000 -0500 --- configure.in 2007-11-23 15:37:41.000000000 -0500 *************** *** 519,523 **** # dynamic version case "${host_os}" in ! darwin8*) READLINE_LIB='${READLINE_LIBRARY}' ;; *) READLINE_LIB=-lreadline ;; esac --- 519,523 ---- # dynamic version case "${host_os}" in ! darwin[[89]]*) READLINE_LIB='${READLINE_LIBRARY}' ;; *) READLINE_LIB=-lreadline ;; esac *** ../bash-3.2-patched/configure 2007-03-24 14:51:22.000000000 -0400 --- configure 2007-11-23 15:46:15.000000000 -0500 *************** *** 4872,4876 **** # dynamic version case "${host_os}" in ! darwin8*) READLINE_LIB='${READLINE_LIBRARY}' ;; *) READLINE_LIB=-lreadline ;; esac --- 4872,4876 ---- # dynamic version case "${host_os}" in ! darwin[89]*) READLINE_LIB='${READLINE_LIBRARY}' ;; *) READLINE_LIB=-lreadline ;; esac *** ../bash-3.2-patched/version.c 2005-05-16 11:58:34.000000000 -0400 --- version.c 2007-11-23 16:03:40.000000000 -0500 *************** *** 80,83 **** printf ("GNU bash, version %s (%s)\n", shell_version_string (), MACHTYPE); if (extended) ! printf (_("Copyright (C) 2005 Free Software Foundation, Inc.\n")); } --- 80,83 ---- printf ("GNU bash, version %s (%s)\n", shell_version_string (), MACHTYPE); if (extended) ! printf (_("Copyright (C) 2007 Free Software Foundation, Inc.\n")); } *** ../bash-3.2/patchlevel.h Thu Apr 13 08:31:04 2006 --- patchlevel.h Mon Oct 16 14:22:54 2006 *************** *** 26,30 **** looks for to find the patch level (for the sccs version string). */ ! #define PATCHLEVEL 25 #endif /* _PATCHLEVEL_H_ */ --- 26,30 ---- looks for to find the patch level (for the sccs version string). */ ! #define PATCHLEVEL 26 #endif /* _PATCHLEVEL_H_ */ -- ``The lyf so short, the craft so long to lerne.'' - Chaucer Live Strong. Chet Ramey, ITS, CWRU chet@case.edu http://tiswww.tis.case.edu/~chet/ From MAILER-DAEMON Wed Jan 02 08:46:03 2008 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1JA3v1-0006eU-Ac for mharc-bug-bash@gnu.org; Wed, 02 Jan 2008 08:46:03 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JA3v0-0006eL-IA for bug-bash@gnu.org; Wed, 02 Jan 2008 08:46:02 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JA3uy-0006dp-OK for bug-bash@gnu.org; Wed, 02 Jan 2008 08:46:02 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JA3uy-0006de-Ed for bug-bash@gnu.org; Wed, 02 Jan 2008 08:46:00 -0500 Received: from mpv4.tis.cwru.edu ([129.22.105.34]) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_3DES_EDE_CBC_SHA1:24) (Exim 4.60) (envelope-from ) id 1JA3uy-0007rY-49 for bug-bash@gnu.org; Wed, 02 Jan 2008 08:46:00 -0500 Received: from mpv5.TIS.cwru.edu (mpv5.TIS.CWRU.Edu [129.22.105.51]) by mpv4.tis.cwru.edu (MOS 3.8.6-GA) with ESMTP id CGG79070 for ; Wed, 2 Jan 2008 08:45:58 -0500 (EST) Received: from caleb.ins.cwru.edu (caleb.INS.CWRU.Edu [129.22.8.211]) by mpv5.TIS.cwru.edu (MOS 3.8.6-GA) with SMTP id DOF09858; Wed, 2 Jan 2008 08:45:57 -0500 (EST) Date: Wed, 2 Jan 2008 08:45:32 -0500 From: Chet Ramey Sender: Chet Ramey To: bug-bash@gnu.org Message-ID: <080102134532.AA00834.SM@caleb.ins.cwru.edu> Read-Receipt-To: chet.ramey@case.edu MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Junkmail-Status: score=10/49, host=mpv4.tis.cwru.edu X-Junkmail-SD-Raw: score=unknown, refid=str=0001.0A010203.477B9596.0060:SCJSTAT1042116,ss=1,fgs=0, ip=129.22.105.51, so=2007-10-30 19:00:17, dmn=5.4.3/2007-11-16 X-Junkmail-IWF: false X-detected-kernel: by monty-python.gnu.org: Genre and OS details not recognized. Cc: chet@case.edu Subject: Bash-3.2 Official Patch 27 X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: chet.ramey@case.edu List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Jan 2008 13:46:02 -0000 BASH PATCH REPORT ================= Bash-Release: 3.2 Patch-ID: bash32-027 Bug-Reported-by: dAniel hAhler Bug-Reference-ID: <4702ED8A.5000503@thequod.de> Bug-Reference-URL: https://bugs.launchpad.net/ubuntu/+source/bash/+bug/119938 Bug-Description: When updating the display after displaying, for instance, a list of possible completions, readline will place the cursor at the wrong position if the prompt contains invisible characters and a newline. Patch: *** ../bash-3.2.25/lib/readline/display.c Mon Aug 6 14:26:29 2007 --- lib/readline/display.c Wed Oct 10 22:43:58 2007 *************** *** 1049,1053 **** else tx = nleft; ! if (_rl_last_c_pos > tx) { _rl_backspace (_rl_last_c_pos - tx); /* XXX */ --- 1049,1053 ---- else tx = nleft; ! if (tx >= 0 && _rl_last_c_pos > tx) { _rl_backspace (_rl_last_c_pos - tx); /* XXX */ *************** *** 1205,1209 **** { register char *ofd, *ols, *oe, *nfd, *nls, *ne; ! int temp, lendiff, wsatend, od, nd; int current_invis_chars; int col_lendiff, col_temp; --- 1205,1209 ---- { register char *ofd, *ols, *oe, *nfd, *nls, *ne; ! int temp, lendiff, wsatend, od, nd, o_cpos; int current_invis_chars; int col_lendiff, col_temp; *************** *** 1466,1469 **** --- 1466,1471 ---- } + o_cpos = _rl_last_c_pos; + /* When this function returns, _rl_last_c_pos is correct, and an absolute cursor postion in multibyte mode, but a buffer index when not in a *************** *** 1475,1479 **** invisible characters in the prompt string. Let's see if setting this when we make sure we're at the end of the drawn prompt string works. */ ! if (current_line == 0 && MB_CUR_MAX > 1 && rl_byte_oriented == 0 && _rl_last_c_pos == prompt_physical_chars) cpos_adjusted = 1; #endif --- 1477,1483 ---- invisible characters in the prompt string. Let's see if setting this when we make sure we're at the end of the drawn prompt string works. */ ! if (current_line == 0 && MB_CUR_MAX > 1 && rl_byte_oriented == 0 && ! (_rl_last_c_pos > 0 || o_cpos > 0) && ! _rl_last_c_pos == prompt_physical_chars) cpos_adjusted = 1; #endif *** ../bash-3.2/patchlevel.h Thu Apr 13 08:31:04 2006 --- patchlevel.h Mon Oct 16 14:22:54 2006 *************** *** 26,30 **** looks for to find the patch level (for the sccs version string). */ ! #define PATCHLEVEL 26 #endif /* _PATCHLEVEL_H_ */ --- 26,30 ---- looks for to find the patch level (for the sccs version string). */ ! #define PATCHLEVEL 27 #endif /* _PATCHLEVEL_H_ */ -- ``The lyf so short, the craft so long to lerne.'' - Chaucer Live Strong. Chet Ramey, ITS, CWRU chet@case.edu http://tiswww.tis.case.edu/~chet/ From MAILER-DAEMON Wed Jan 02 08:46:29 2008 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1JA3vR-0006oV-On for mharc-bug-bash@gnu.org; Wed, 02 Jan 2008 08:46:29 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JA3vP-0006nl-H7 for bug-bash@gnu.org; Wed, 02 Jan 2008 08:46:27 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JA3vM-0006nF-3E for bug-bash@gnu.org; Wed, 02 Jan 2008 08:46:26 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JA3vL-0006n0-QH for bug-bash@gnu.org; Wed, 02 Jan 2008 08:46:23 -0500 Received: from mpv2.tis.cwru.edu ([129.22.105.37]) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_3DES_EDE_CBC_SHA1:24) (Exim 4.60) (envelope-from ) id 1JA3vL-0007wj-Io for bug-bash@gnu.org; Wed, 02 Jan 2008 08:46:23 -0500 Received: from mpv6.TIS.cwru.edu (mpv6.TIS.CWRU.Edu [129.22.104.221]) by mpv2.tis.cwru.edu (MOS 3.8.6-GA) with ESMTP id CPP41213 for ; Wed, 2 Jan 2008 08:46:21 -0500 (EST) Received: from caleb.ins.cwru.edu (caleb.INS.CWRU.Edu [129.22.8.211]) by mpv6.TIS.cwru.edu (MOS 3.8.6-GA) with SMTP id DON37482; Wed, 2 Jan 2008 08:46:20 -0500 (EST) Date: Wed, 2 Jan 2008 08:45:52 -0500 From: Chet Ramey Sender: Chet Ramey To: bug-bash@gnu.org Message-ID: <080102134552.AA00834.SM@caleb.ins.cwru.edu> Read-Receipt-To: chet.ramey@case.edu MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Junkmail-Status: score=10/49, host=mpv2.tis.cwru.edu X-Junkmail-SD-Raw: score=unknown, refid=str=0001.0A090203.477B95AD.0101,ss=1,fgs=0, ip=129.22.104.221, so=2007-10-30 19:00:17, dmn=5.4.3/2007-11-16 X-Junkmail-IWF: false X-detected-kernel: by monty-python.gnu.org: Genre and OS details not recognized. Cc: chet@case.edu Subject: Bash-3.2 Official Patch 28 X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: chet.ramey@case.edu List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Jan 2008 13:46:27 -0000 BASH PATCH REPORT ================= Bash-Release: 3.2 Patch-ID: bash32-028 Bug-Reported-by: dAniel hAhler Bug-Reference-ID: Bug-Reference-URL: Bug-Description: Under some circumstances, readline will incorrectly display a prompt string containing invisible characters after the final newline. Patch: *** ../bash-3.2-patched/lib/readline/display.c 2007-08-25 13:47:08.000000000 -0400 --- lib/readline/display.c 2007-11-10 17:51:29.000000000 -0500 *************** *** 392,396 **** local_prompt = expand_prompt (p, &prompt_visible_length, &prompt_last_invisible, ! (int *)NULL, &prompt_physical_chars); c = *t; *t = '\0'; --- 420,424 ---- local_prompt = expand_prompt (p, &prompt_visible_length, &prompt_last_invisible, ! &prompt_invis_chars_first_line, &prompt_physical_chars); c = *t; *t = '\0'; *************** *** 399,403 **** local_prompt_prefix = expand_prompt (prompt, &prompt_prefix_length, (int *)NULL, ! &prompt_invis_chars_first_line, (int *)NULL); *t = c; --- 427,431 ---- local_prompt_prefix = expand_prompt (prompt, &prompt_prefix_length, (int *)NULL, ! (int *)NULL, (int *)NULL); *t = c; *** ../bash-3.2/patchlevel.h Thu Apr 13 08:31:04 2006 --- patchlevel.h Mon Oct 16 14:22:54 2006 *************** *** 26,30 **** looks for to find the patch level (for the sccs version string). */ ! #define PATCHLEVEL 27 #endif /* _PATCHLEVEL_H_ */ --- 26,30 ---- looks for to find the patch level (for the sccs version string). */ ! #define PATCHLEVEL 28 #endif /* _PATCHLEVEL_H_ */ -- ``The lyf so short, the craft so long to lerne.'' - Chaucer Live Strong. Chet Ramey, ITS, CWRU chet@case.edu http://tiswww.tis.case.edu/~chet/ From MAILER-DAEMON Wed Jan 02 08:48:36 2008 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1JA3xU-0007Yj-7Q for mharc-bug-bash@gnu.org; Wed, 02 Jan 2008 08:48:36 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JA3xS-0007Ye-Ne for bug-bash@gnu.org; Wed, 02 Jan 2008 08:48:34 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JA3xQ-0007YS-Ab for bug-bash@gnu.org; Wed, 02 Jan 2008 08:48:33 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JA3xQ-0007YP-62 for bug-bash@gnu.org; Wed, 02 Jan 2008 08:48:32 -0500 Received: from mpv4.tis.cwru.edu ([129.22.105.34]) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_3DES_EDE_CBC_SHA1:24) (Exim 4.60) (envelope-from ) id 1JA3xP-0008Gr-W9 for bug-bash@gnu.org; Wed, 02 Jan 2008 08:48:32 -0500 Received: from mpv6.TIS.cwru.edu (mpv6.TIS.CWRU.Edu [129.22.104.221]) by mpv4.tis.cwru.edu (MOS 3.8.6-GA) with ESMTP id CGG79140 for ; Wed, 2 Jan 2008 08:48:27 -0500 (EST) Received: from caleb.ins.cwru.edu (caleb.INS.CWRU.Edu [129.22.8.211]) by mpv6.TIS.cwru.edu (MOS 3.8.6-GA) with SMTP id DON39031; Wed, 2 Jan 2008 08:48:27 -0500 (EST) Date: Wed, 2 Jan 2008 08:48:04 -0500 From: Chet Ramey Sender: Chet Ramey To: bug-bash@gnu.org Message-ID: <080102134804.AA00858.SM@caleb.ins.cwru.edu> Read-Receipt-To: chet.ramey@case.edu MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Junkmail-Status: score=10/49, host=mpv4.tis.cwru.edu X-Junkmail-SD-Raw: score=unknown, refid=str=0001.0A010205.477B962E.014B,ss=1,fgs=0, ip=129.22.104.221, so=2007-10-30 19:00:17, dmn=5.4.3/2007-11-16 X-Junkmail-IWF: false X-detected-kernel: by monty-python.gnu.org: Genre and OS details not recognized. Cc: chet@case.edu Subject: Bash-3.2 Official Patch 29 X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: chet.ramey@case.edu List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Jan 2008 13:48:34 -0000 BASH PATCH REPORT ================= Bash-Release: 3.2 Patch-ID: bash32-029 Bug-Reported-by: Tomas Janousek Bug-Reference-ID: <20071102104034.GA26893@redhat.com> Bug-Reference-URL: https://bugzilla.redhat.com/show_bug.cgi?id=286861 Bug-Description: When the bash arithmetic expression evaluator has temporarily turned off evalation, such as when parsing a pre- or post-decrement or -increment operator, and an error occurs, evaluation is not re-enabled. Patch: *** ../bash-3.2-patched/expr.c 2007-08-25 13:47:05.000000000 -0400 --- expr.c 2007-10-18 08:08:44.000000000 -0400 *************** *** 287,290 **** --- 287,292 ---- } free (expr_stack[expr_depth]); /* free the allocated EXPR_CONTEXT */ + + noeval = 0; /* XXX */ } *************** *** 320,323 **** --- 322,326 ---- val = 0; + noeval = 0; FASTCOPY (evalbuf, oevalbuf, sizeof (evalbuf)); *** ../bash-3.2/patchlevel.h Thu Apr 13 08:31:04 2006 --- patchlevel.h Mon Oct 16 14:22:54 2006 *************** *** 26,30 **** looks for to find the patch level (for the sccs version string). */ ! #define PATCHLEVEL 28 #endif /* _PATCHLEVEL_H_ */ --- 26,30 ---- looks for to find the patch level (for the sccs version string). */ ! #define PATCHLEVEL 29 #endif /* _PATCHLEVEL_H_ */ -- ``The lyf so short, the craft so long to lerne.'' - Chaucer Live Strong. Chet Ramey, ITS, CWRU chet@case.edu http://tiswww.tis.case.edu/~chet/ From MAILER-DAEMON Wed Jan 02 08:49:13 2008 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1JA3y5-0008Hd-G5 for mharc-bug-bash@gnu.org; Wed, 02 Jan 2008 08:49:13 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JA3y3-0008Di-Nd for bug-bash@gnu.org; Wed, 02 Jan 2008 08:49:11 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JA3y2-0008AZ-4X for bug-bash@gnu.org; Wed, 02 Jan 2008 08:49:11 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JA3y1-0008A7-Ul for bug-bash@gnu.org; Wed, 02 Jan 2008 08:49:09 -0500 Received: from mpv4.tis.cwru.edu ([129.22.105.34]) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_3DES_EDE_CBC_SHA1:24) (Exim 4.60) (envelope-from ) id 1JA3y1-0008MA-M5 for bug-bash@gnu.org; Wed, 02 Jan 2008 08:49:09 -0500 Received: from mpv6.TIS.cwru.edu (mpv6.TIS.CWRU.Edu [129.22.104.221]) by mpv4.tis.cwru.edu (MOS 3.8.6-GA) with ESMTP id CGG79164 for ; Wed, 2 Jan 2008 08:49:08 -0500 (EST) Received: from caleb.ins.cwru.edu (caleb.INS.CWRU.Edu [129.22.8.211]) by mpv6.TIS.cwru.edu (MOS 3.8.6-GA) with SMTP id DON39464; Wed, 2 Jan 2008 08:49:07 -0500 (EST) Date: Wed, 2 Jan 2008 08:48:21 -0500 From: Chet Ramey Sender: Chet Ramey To: bug-bash@gnu.org Message-ID: <080102134821.AA00858.SM@caleb.ins.cwru.edu> Read-Receipt-To: chet.ramey@case.edu MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Junkmail-Status: score=10/49, host=mpv4.tis.cwru.edu X-Junkmail-SD-Raw: score=unknown, refid=str=0001.0A010207.477B9654.0034,ss=1,fgs=0, ip=129.22.104.221, so=2007-10-30 19:00:17, dmn=5.4.3/2007-11-16 X-Junkmail-IWF: false X-detected-kernel: by monty-python.gnu.org: Genre and OS details not recognized. Cc: chet@case.edu Subject: Bash-3.2 Official Patch 30 X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: chet.ramey@case.edu List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Jan 2008 13:49:11 -0000 BASH PATCH REPORT ================= Bash-Release: 3.2 Patch-ID: bash32-030 Bug-Reported-by: Paul Eggert Andreas Schwab Bug-Reference-ID: <877il0nu84.fsf_-_@penguin.cs.ucla.edu> Bug-Reference-URL: http://lists.gnu.org/archive/html/bug-bash/2007-11/msg00023.html http://lists.gnu.org/archive/html/bug-bash/2007-11/msg00022.htmlhttp://lists.gnu.org/archive/html/bug-bash/2007-11/msg00022.html Bug-Description: If redirections attached to a compound command fail, bash does not set the command's exit status correctly. This only happens when the command is the first in a sequential list. Patch: *** ../bash-3.2-patched/execute_cmd.c 2007-03-24 14:51:05.000000000 -0400 --- execute_cmd.c 2007-11-05 22:31:14.000000000 -0500 *************** *** 615,619 **** redirection_undo_list = (REDIRECT *)NULL; dispose_exec_redirects (); ! return (EXECUTION_FAILURE); } --- 620,624 ---- redirection_undo_list = (REDIRECT *)NULL; dispose_exec_redirects (); ! return (last_command_exit_value = EXECUTION_FAILURE); } *** ../bash-3.2/patchlevel.h Thu Apr 13 08:31:04 2006 --- patchlevel.h Mon Oct 16 14:22:54 2006 *************** *** 26,30 **** looks for to find the patch level (for the sccs version string). */ ! #define PATCHLEVEL 29 #endif /* _PATCHLEVEL_H_ */ --- 26,30 ---- looks for to find the patch level (for the sccs version string). */ ! #define PATCHLEVEL 30 #endif /* _PATCHLEVEL_H_ */ -- ``The lyf so short, the craft so long to lerne.'' - Chaucer Live Strong. Chet Ramey, ITS, CWRU chet@case.edu http://tiswww.tis.case.edu/~chet/ From MAILER-DAEMON Wed Jan 02 08:49:28 2008 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1JA3yK-00009D-3G for mharc-bug-bash@gnu.org; Wed, 02 Jan 2008 08:49:28 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JA3yJ-00007m-2M for bug-bash@gnu.org; Wed, 02 Jan 2008 08:49:27 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JA3yH-00005V-Be for bug-bash@gnu.org; Wed, 02 Jan 2008 08:49:26 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JA3yH-00005M-7c for bug-bash@gnu.org; Wed, 02 Jan 2008 08:49:25 -0500 Received: from mpv3.tis.cwru.edu ([129.22.105.35]) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_3DES_EDE_CBC_SHA1:24) (Exim 4.60) (envelope-from ) id 1JA3yG-0008OY-VW for bug-bash@gnu.org; Wed, 02 Jan 2008 08:49:25 -0500 Received: from mpv5.TIS.cwru.edu (mpv5.TIS.CWRU.Edu [129.22.105.51]) by mpv3.TIS.cwru.edu (MOS 3.8.6-GA) with ESMTP id CBA74647 for ; Wed, 2 Jan 2008 08:49:23 -0500 (EST) Received: from caleb.ins.cwru.edu (caleb.INS.CWRU.Edu [129.22.8.211]) by mpv5.TIS.cwru.edu (MOS 3.8.6-GA) with SMTP id DOF12408; Wed, 2 Jan 2008 08:49:23 -0500 (EST) Date: Wed, 2 Jan 2008 08:49:02 -0500 From: Chet Ramey Sender: Chet Ramey To: bug-bash@gnu.org Message-ID: <080102134902.AA00858.SM@caleb.ins.cwru.edu> Read-Receipt-To: chet.ramey@case.edu MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Junkmail-Status: score=10/49, host=mpv3.cwru.edu X-Junkmail-SD-Raw: score=unknown, refid=str=0001.0A090201.477B9663.00D0:SCJSTAT1042116,ss=1,fgs=0, ip=129.22.105.51, so=2007-10-30 19:00:17, dmn=5.4.3/2007-11-16 X-Junkmail-IWF: false X-detected-kernel: by monty-python.gnu.org: Genre and OS details not recognized. Cc: chet@case.edu Subject: Bash-3.2 Official Patch 31 X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: chet.ramey@case.edu List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Jan 2008 13:49:27 -0000 BASH PATCH REPORT ================= Bash-Release: 3.2 Patch-ID: bash32-031 Bug-Reported-by: Miroslav Lichvar Bug-Reference-ID: Fri, 02 Nov 2007 14:07:45 +0100 Bug-Reference-URL: http://lists.gnu.org/archive/html/bug-readline/2007-11/msg00000.html Bug-Description: In certain cases when outputting characters at the end of the line, e.g., when displaying the prompt string, readline positions the cursor incorrectly if the prompt string contains invisible characters and the text being drawn begins before the last invisible character in the line. Patch: *** ../bash-3.2-patched/lib/readline/display.c 2007-08-25 13:47:08.000000000 -0400 --- lib/readline/display.c 2007-11-10 17:51:29.000000000 -0500 *************** *** 1566,1574 **** else { - /* We have horizontal scrolling and we are not inserting at - the end. We have invisible characters in this line. This - is a dumb update. */ _rl_output_some_chars (nfd, temp); _rl_last_c_pos += col_temp; return; } --- 1619,1632 ---- else { _rl_output_some_chars (nfd, temp); _rl_last_c_pos += col_temp; + /* If nfd begins before any invisible characters in the prompt, + adjust _rl_last_c_pos to account for wrap_offset and set + cpos_adjusted to let the caller know. */ + if (current_line == 0 && wrap_offset && ((nfd - new) <= prompt_last_invisible)) + { + _rl_last_c_pos -= wrap_offset; + cpos_adjusted = 1; + } return; } *** ../bash-3.2/patchlevel.h Thu Apr 13 08:31:04 2006 --- patchlevel.h Mon Oct 16 14:22:54 2006 *************** *** 26,30 **** looks for to find the patch level (for the sccs version string). */ ! #define PATCHLEVEL 30 #endif /* _PATCHLEVEL_H_ */ --- 26,30 ---- looks for to find the patch level (for the sccs version string). */ ! #define PATCHLEVEL 31 #endif /* _PATCHLEVEL_H_ */ -- ``The lyf so short, the craft so long to lerne.'' - Chaucer Live Strong. Chet Ramey, ITS, CWRU chet@case.edu http://tiswww.tis.case.edu/~chet/ From MAILER-DAEMON Wed Jan 02 08:49:53 2008 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1JA3yj-0000eG-Cq for mharc-bug-bash@gnu.org; Wed, 02 Jan 2008 08:49:53 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JA3yi-0000d0-0b for bug-bash@gnu.org; Wed, 02 Jan 2008 08:49:52 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JA3yh-0000cC-FA for bug-bash@gnu.org; Wed, 02 Jan 2008 08:49:51 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JA3yg-0000bo-Sa for bug-bash@gnu.org; Wed, 02 Jan 2008 08:49:50 -0500 Received: from mpv3.tis.cwru.edu ([129.22.105.35]) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_3DES_EDE_CBC_SHA1:24) (Exim 4.60) (envelope-from ) id 1JA3yg-0008TG-Mm for bug-bash@gnu.org; Wed, 02 Jan 2008 08:49:50 -0500 Received: from mpv6.TIS.cwru.edu (mpv6.TIS.CWRU.Edu [129.22.104.221]) by mpv3.TIS.cwru.edu (MOS 3.8.6-GA) with ESMTP id CBA74658 for ; Wed, 2 Jan 2008 08:49:49 -0500 (EST) Received: from caleb.ins.cwru.edu (caleb.INS.CWRU.Edu [129.22.8.211]) by mpv6.TIS.cwru.edu (MOS 3.8.6-GA) with SMTP id DON39963; Wed, 2 Jan 2008 08:49:48 -0500 (EST) Date: Wed, 2 Jan 2008 08:49:17 -0500 From: Chet Ramey Sender: Chet Ramey To: bug-bash@gnu.org Message-ID: <080102134917.AA00858.SM@caleb.ins.cwru.edu> Read-Receipt-To: chet.ramey@case.edu MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Junkmail-Status: score=10/49, host=mpv3.cwru.edu X-Junkmail-SD-Raw: score=unknown, refid=str=0001.0A090209.477B967D.0046,ss=1,fgs=0, ip=129.22.104.221, so=2007-10-30 19:00:17, dmn=5.4.3/2007-11-16 X-Junkmail-IWF: false X-detected-kernel: by monty-python.gnu.org: Genre and OS details not recognized. Cc: chet@case.edu Subject: Bash-3.2 Official Patch 32 X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: chet.ramey@case.edu List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Jan 2008 13:49:52 -0000 BASH PATCH REPORT ================= Bash-Release: 3.2 Patch-ID: bash32-032 Bug-Reported-by: Uwe Doering Bug-Reference-ID: <46F3DD72.2090801@geminix.org> Bug-Reference-URL: http://lists.gnu.org/archive/html/bug-bash/2007-09/msg00102.html Bug-Description: There is an off-by-one error in the code that buffers characters received very quickly in succession, causing characters to be dropped. Patch: *** ../bash-3.2-patched/lib/readline/input.c 2007-08-25 13:47:10.000000000 -0400 --- lib/readline/input.c 2007-10-12 22:55:25.000000000 -0400 *************** *** 155,159 **** pop_index--; if (pop_index < 0) ! pop_index = ibuffer_len - 1; ibuffer[pop_index] = key; return (1); --- 155,159 ---- pop_index--; if (pop_index < 0) ! pop_index = ibuffer_len; ibuffer[pop_index] = key; return (1); *** ../bash-3.2/patchlevel.h Thu Apr 13 08:31:04 2006 --- patchlevel.h Mon Oct 16 14:22:54 2006 *************** *** 26,30 **** looks for to find the patch level (for the sccs version string). */ ! #define PATCHLEVEL 31 #endif /* _PATCHLEVEL_H_ */ --- 26,30 ---- looks for to find the patch level (for the sccs version string). */ ! #define PATCHLEVEL 32 #endif /* _PATCHLEVEL_H_ */ -- ``The lyf so short, the craft so long to lerne.'' - Chaucer Live Strong. Chet Ramey, ITS, CWRU chet@case.edu http://tiswww.tis.case.edu/~chet/ From MAILER-DAEMON Wed Jan 02 08:50:15 2008 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1JA3z5-000103-Mc for mharc-bug-bash@gnu.org; Wed, 02 Jan 2008 08:50:15 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JA3z3-0000zV-VU for bug-bash@gnu.org; Wed, 02 Jan 2008 08:50:14 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JA3z3-0000zB-De for bug-bash@gnu.org; Wed, 02 Jan 2008 08:50:13 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JA3z3-0000z6-8n for bug-bash@gnu.org; Wed, 02 Jan 2008 08:50:13 -0500 Received: from mpv3.tis.cwru.edu ([129.22.105.35]) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_3DES_EDE_CBC_SHA1:24) (Exim 4.60) (envelope-from ) id 1JA3z3-00006O-2h for bug-bash@gnu.org; Wed, 02 Jan 2008 08:50:13 -0500 Received: from mpv6.TIS.cwru.edu (mpv6.TIS.CWRU.Edu [129.22.104.221]) by mpv3.TIS.cwru.edu (MOS 3.8.6-GA) with ESMTP id CBA74672 for ; Wed, 2 Jan 2008 08:50:11 -0500 (EST) Received: from caleb.ins.cwru.edu (caleb.INS.CWRU.Edu [129.22.8.211]) by mpv6.TIS.cwru.edu (MOS 3.8.6-GA) with SMTP id DON40174; Wed, 2 Jan 2008 08:50:10 -0500 (EST) Date: Wed, 2 Jan 2008 08:49:44 -0500 From: Chet Ramey Sender: Chet Ramey To: bug-bash@gnu.org Message-ID: <080102134944.AA00858.SM@caleb.ins.cwru.edu> Read-Receipt-To: chet.ramey@case.edu MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Junkmail-Status: score=10/49, host=mpv3.cwru.edu X-Junkmail-SD-Raw: score=unknown, refid=str=0001.0A09020B.477B9694.0004,ss=1,fgs=0, ip=129.22.104.221, so=2007-10-30 19:00:17, dmn=5.4.3/2007-11-16 X-Junkmail-IWF: false X-detected-kernel: by monty-python.gnu.org: Genre and OS details not recognized. Cc: chet@case.edu Subject: Bash-3.2 Official Patch 33 X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: chet.ramey@case.edu List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Jan 2008 13:50:14 -0000 BASH PATCH REPORT ================= Bash-Release: 3.2 Patch-ID: bash32-033 Bug-Reported-by: Christophe Martin Bug-Reference-ID: <465ABA4A.3030805@free.fr> Bug-Reference-URL: http://lists.gnu.org/archive/html/bug-bash/2007-05/msg00104.html Bug-Description: References made within a function to an uninitialized local array variable using the [*] subscript in a double-quoted string can result in spurious ASCII 127 characters in the expanded value. Patch: *** ../bash-3.2-patched/arrayfunc.c 2007-08-25 13:47:05.000000000 -0400 --- arrayfunc.c 2007-05-31 11:55:46.000000000 -0400 *************** *** 723,727 **** { if (rtype) ! *rtype = 1; if (allow_all == 0) { --- 723,727 ---- { if (rtype) ! *rtype = (t[0] == '*') ? 1 : 2; if (allow_all == 0) { *** ../bash-3.2-patched/subst.c 2007-08-25 13:47:08.000000000 -0400 --- subst.c 2007-11-14 15:43:00.000000000 -0500 *************** *** 4908,4915 **** intmax_t arg_index; SHELL_VAR *var; ! int atype; ret = 0; temp = 0; /* Handle multiple digit arguments, as in ${11}. */ --- 4973,4981 ---- intmax_t arg_index; SHELL_VAR *var; ! int atype, rflags; ret = 0; temp = 0; + rflags = 0; /* Handle multiple digit arguments, as in ${11}. */ *************** *** 4944,4947 **** --- 5010,5015 ---- ? quote_string (temp) : quote_escapes (temp); + else if (atype == 1 && temp && QUOTED_NULL (temp) && (quoted & (Q_DOUBLE_QUOTES|Q_HERE_DOCUMENT))) + rflags |= W_HASQUOTEDNULL; } #endif *************** *** 4971,4974 **** --- 5039,5043 ---- ret = alloc_word_desc (); ret->word = temp; + ret->flags |= rflags; } return ret; *** ../bash-3.2/patchlevel.h Thu Apr 13 08:31:04 2006 --- patchlevel.h Mon Oct 16 14:22:54 2006 *************** *** 26,30 **** looks for to find the patch level (for the sccs version string). */ ! #define PATCHLEVEL 32 #endif /* _PATCHLEVEL_H_ */ --- 26,30 ---- looks for to find the patch level (for the sccs version string). */ ! #define PATCHLEVEL 33 #endif /* _PATCHLEVEL_H_ */ -- ``The lyf so short, the craft so long to lerne.'' - Chaucer Live Strong. Chet Ramey, ITS, CWRU chet@case.edu http://tiswww.tis.case.edu/~chet/ From MAILER-DAEMON Wed Jan 02 13:43:25 2008 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1JA8Yn-0006Ne-1O for mharc-bug-bash@gnu.org; Wed, 02 Jan 2008 13:43:25 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JA8Yl-0006N4-CE for bug-bash@gnu.org; Wed, 02 Jan 2008 13:43:23 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JA8Yj-0006MI-CR for Bug-bash@gnu.org; Wed, 02 Jan 2008 13:43:22 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JA8Yj-0006MB-6g for Bug-bash@gnu.org; Wed, 02 Jan 2008 13:43:21 -0500 Received: from joseki.proulx.com ([216.17.153.58]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JA8Yi-0006Lr-Rn for Bug-bash@gnu.org; Wed, 02 Jan 2008 13:43:21 -0500 Received: from dementia.proulx.com (dementia.proulx.com [192.168.1.115]) by joseki.proulx.com (Postfix) with ESMTP id 50684FA68; Wed, 2 Jan 2008 11:43:20 -0700 (MST) Received: by dementia.proulx.com (Postfix, from userid 1000) id 438B73CC62A; Wed, 2 Jan 2008 11:43:20 -0700 (MST) Date: Wed, 2 Jan 2008 11:43:20 -0700 To: Matthew_S Message-ID: <20080102184320.GA5606@dementia.proulx.com> Mail-Followup-To: Matthew_S , Bug-bash@gnu.org References: <14575394.post@talk.nabble.com> <20080102093630.GA19813@dementia.proulx.com> <14575880.post@talk.nabble.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <14575880.post@talk.nabble.com> User-Agent: Mutt/1.5.13 (2006-08-11) From: bob@proulx.com (Bob Proulx) X-detected-kernel: by monty-python.gnu.org: Genre and OS details not recognized. Cc: Bug-bash@gnu.org Subject: Re: Taking input line by line from a config file in Bash X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Jan 2008 18:43:23 -0000 Matthew_S wrote: > With the 'while read line', it appears that I don't need to keep track of > the line numbers. In fact this below does exactly what I need it to do; Good. > cat $File | # Supply input from a file Search the web for "useless use of cat". Your use of it here is useless. But it is more than simply useless here as it causes the while loop to be run inside of a subshell. This has subtle effects that often trip people up. (e.g. Variables set inside the loop don't apply outside the subshell. See Bash FAQ E4 for more information.) > while read line # As you suggested... > > do echo $line > echo >> $RESULTS > echo $line >> $RESULTS > $line > [ $? == 0 ] && echo "PASSED" >> $RESULTS || echo "FAILED" >> $RESULTS Double check the test operator syntax. (e.g. 'help test' or 'man test') Use of "==" is a bash extension. Okay in a #!/bin/bash script but in #!/bin/sh script that should be a single "=" for portability. I suggest wrapping the entire group within curly braces and then redirecting the entire list. (e.g. { ... ;} >> $RESULTS) while read line; do echo $line { echo echo $line $line && echo "PASSED" || echo "FAILED" } >> $RESULTS done < $File > exit I always like to see an explicit 'exit 0' or 'exit 1' as appropriate. Use of plain 'exit' passes the exit status of the last command that was executed in accumulator machine style. That seems counter to the explicit use of an exit there. Plus many commands such as 'grep' overload the return code with status information that is not appropriate for an exit code elsewhere in the script. Better to be explicit here. Bob From MAILER-DAEMON Thu Jan 03 03:56:44 2008 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1JALsa-0001iU-2Z for mharc-bug-bash@gnu.org; Thu, 03 Jan 2008 03:56:44 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JALsW-0001fx-6b for bug-bash@gnu.org; Thu, 03 Jan 2008 03:56:40 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JALsU-0001f3-5I for Bug-bash@gnu.org; Thu, 03 Jan 2008 03:56:39 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JALsT-0001ek-VD for Bug-bash@gnu.org; Thu, 03 Jan 2008 03:56:37 -0500 Received: from kuber.nabble.com ([216.139.236.158]) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1JALsT-00089l-K3 for Bug-bash@gnu.org; Thu, 03 Jan 2008 03:56:37 -0500 Received: from isper.nabble.com ([192.168.236.156]) by kuber.nabble.com with esmtp (Exim 4.63) (envelope-from ) id 1JALsS-0001fB-7G for Bug-bash@gnu.org; Thu, 03 Jan 2008 00:56:36 -0800 Message-ID: <14593790.post@talk.nabble.com> Date: Thu, 3 Jan 2008 00:56:36 -0800 (PST) From: Matthew_S To: Bug-bash@gnu.org In-Reply-To: <20080102184320.GA5606@dementia.proulx.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Nabble-From: M_Sleaford@hotmail.com References: <14575394.post@talk.nabble.com> <20080102093630.GA19813@dementia.proulx.com> <14575880.post@talk.nabble.com> <20080102184320.GA5606@dementia.proulx.com> X-detected-kernel: by monty-python.gnu.org: Linux 2.6 (newer, 3) Cc: Subject: Re: Taking input line by line from a config file in Bash X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Jan 2008 08:56:40 -0000 I see what you're saying. That's interesting about cat, thanks for the heads up. while read line do { echo $line > /dev/null && echo $line "PASSED" || echo $line "FAILED" } >> $RESULTS done < $FILE exit 0 This does the same thing, but seems to be more streamline... cleaner. Those are some useful points for future reference. Thanks again. Matthew -- View this message in context: http://www.nabble.com/Taking-input-line-by-line-from-a-config-file-in-Bash-tp14575394p14593790.html Sent from the Gnu - Bash mailing list archive at Nabble.com. From MAILER-DAEMON Thu Jan 03 10:39:16 2008 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1JASA8-0005U3-8w for mharc-bug-bash@gnu.org; Thu, 03 Jan 2008 10:39:16 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JASA5-0005Rp-PT for bug-bash@gnu.org; Thu, 03 Jan 2008 10:39:13 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JASA4-0005Pi-7C for Bug-bash@gnu.org; Thu, 03 Jan 2008 10:39:13 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JASA3-0005Pb-RV for Bug-bash@gnu.org; Thu, 03 Jan 2008 10:39:11 -0500 Received: from kuber.nabble.com ([216.139.236.158]) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1JASA2-0006D7-QO for Bug-bash@gnu.org; Thu, 03 Jan 2008 10:39:11 -0500 Received: from isper.nabble.com ([192.168.236.156]) by kuber.nabble.com with esmtp (Exim 4.63) (envelope-from ) id 1JAS9y-0005CN-NB for Bug-bash@gnu.org; Thu, 03 Jan 2008 07:39:06 -0800 Message-ID: <14599119.post@talk.nabble.com> Date: Thu, 3 Jan 2008 07:39:06 -0800 (PST) From: Matthew_S To: Bug-bash@gnu.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Nabble-From: M_Sleaford@hotmail.com X-detected-kernel: by monty-python.gnu.org: Linux 2.6 (newer, 3) Cc: Subject: Finding out current inode size X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Jan 2008 15:39:14 -0000 I've been trawilng the web trying to find out how to get the current inode size for a file. I now know how to change the max inode size for the system; mkfs -i size=xxx which also begs the question how to find out the current limit of the system. I'm guessing it'll be the default 256 bytes, but I'd like to be sure. The reason I'd like to know the current inode size of a file is because I'd like to create a large enough number of extended attributes in order to test the inodes boundaries and the subsequent handling. -- View this message in context: http://www.nabble.com/Finding-out-current-inode-size-tp14599119p14599119.html Sent from the Gnu - Bash mailing list archive at Nabble.com. From MAILER-DAEMON Fri Jan 04 06:57:23 2008 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1JAlAx-0000ep-MT for mharc-bug-bash@gnu.org; Fri, 04 Jan 2008 06:57:23 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JAlAv-0000b8-Lp for bug-bash@gnu.org; Fri, 04 Jan 2008 06:57:21 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JAlAu-0000Ym-Iz for bug-bash@gnu.org; Fri, 04 Jan 2008 06:57:21 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JAlAu-0000YV-DJ for bug-bash@gnu.org; Fri, 04 Jan 2008 06:57:20 -0500 Received: from mtaout3.012.net.il ([84.95.2.7]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JAlAu-0007l4-6N for bug-bash@gnu.org; Fri, 04 Jan 2008 06:57:20 -0500 Received: from skeeve.com ([87.69.106.241]) by i_mtaout3.012.net.il (HyperSendmail v2004.12) with ESMTPA id <0JU400GQUCFYACU0@i_mtaout3.012.net.il> for bug-bash@gnu.org; Fri, 04 Jan 2008 14:09:35 +0200 (IST) Received: from skeeve.com (localhost [127.0.0.1]) by skeeve.com (8.14.1/8.13.8) with ESMTP id m04Bv5CT004782; Fri, 04 Jan 2008 13:57:05 +0200 Received: (from arnold@localhost) by skeeve.com (8.14.1/8.13.8/Submit) id m04Buimu004779; Fri, 04 Jan 2008 13:56:44 +0200 Date: Fri, 04 Jan 2008 13:56:44 +0200 From: Aharon Robbins In-reply-to: X-012-Sender: arobbins@012.net.il To: jidanni@jidanni.org Message-id: <200801041156.m04Buimu004779@skeeve.com> Organization: Pioneer Consulting, Ltd. Content-transfer-encoding: 7BIT X-Newsgroups: gnu.bash.bug X-detected-kernel: by monty-python.gnu.org: Solaris 9.1 Cc: bug-bash@gnu.org Subject: Re: ESC . vs. ^R, ^P again X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Jan 2008 11:57:22 -0000 I think you want ESC _ which will pull in the last word of the previous command. Arnold In article you write: >As there years pass I use ESC . daily hoping that it will get the last >chunk of the previous line on my screen, despite any ^P's or ^R's I >might have done. > >Never have I wanted it to consider those ^P's and ^R's. > >So even though you said that was a early design choice, perhaps you >could still leave (behind for posterity) a toggle variable or new >binding to do my dumber mode. > >My http://www.useit.com/alertbox/ style survey of many years with >hundreds of hours with, er, 1 user, "indicates", as they say in the >medical business, that this is needed. > >Surely you (all) are not such constant hammerers of ESC . as I. Vote >for Choice. > > From MAILER-DAEMON Fri Jan 04 18:46:12 2008 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1JAwEu-0002US-NV for mharc-bug-bash@gnu.org; Fri, 04 Jan 2008 18:46:12 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JAwEt-0002UN-7S for bug-bash@gnu.org; Fri, 04 Jan 2008 18:46:11 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JAwEp-0002QU-RP for bug-bash@gnu.org; Fri, 04 Jan 2008 18:46:10 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JAwEp-0002QG-N0 for bug-bash@gnu.org; Fri, 04 Jan 2008 18:46:07 -0500 Received: from lax-green-bigip-5.dreamhost.com ([208.113.200.5] helo=blingymail-a1.g.dreamhost.com) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JAwEp-00080E-Be for bug-bash@gnu.org; Fri, 04 Jan 2008 18:46:07 -0500 Received: from jidanni1 (122-127-32-185.dynamic.hinet.net [122.127.32.185]) by blingymail-a1.g.dreamhost.com (Postfix) with ESMTP id C4FCA5CBC4; Fri, 4 Jan 2008 15:46:01 -0800 (PST) To: arnold@skeeve.com References: <200801041156.m04Buimu004779@skeeve.com> From: jidanni@jidanni.org Date: Sat, 05 Jan 2008 07:45:56 +0800 Message-ID: <87fxxdtarv.fsf@jidanni.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-detected-kernel: by monty-python.gnu.org: Linux 2.4-2.6 Cc: bug-bash@gnu.org Subject: Re: ESC . vs. ^R, ^P again X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Jan 2008 23:46:11 -0000 A> I think you want ESC _ which will pull in the last word of the A> previous command. Thanks but it's $ man bash|grep M-_ yank-last-arg (M-., M-_) insert-last-argument (M-., M-_) the same as M-., whose behavior I was railing against. From MAILER-DAEMON Sun Jan 06 06:30:43 2008 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1JBTiE-00039k-SE for mharc-bug-bash@gnu.org; Sun, 06 Jan 2008 06:30:42 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JBTiD-00037R-Ok for bug-bash@gnu.org; Sun, 06 Jan 2008 06:30:41 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JBTiC-00036D-Jf for bug-bash@gnu.org; Sun, 06 Jan 2008 06:30:41 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JBTiC-00035p-Dg for bug-bash@gnu.org; Sun, 06 Jan 2008 06:30:40 -0500 Received: from cs1.cs.huji.ac.il ([132.65.16.10]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JBTiB-0005jw-QY for bug-bash@gnu.org; Sun, 06 Jan 2008 06:30:40 -0500 Received: from serin.cs.huji.ac.il ([132.65.80.149]) by cs1.cs.huji.ac.il with esmtp id 1JBTi2-000FRa-Nu for bug-bash@gnu.org; Sun, 06 Jan 2008 13:30:30 +0200 Received: from alsbergt by serin.cs.huji.ac.il with local (Exim 4.60 (FreeBSD)) (envelope-from ) id 1JBTi2-000Hag-Kf for bug-bash@gnu.org; Sun, 06 Jan 2008 13:30:30 +0200 Date: Sun, 6 Jan 2008 13:30:30 +0200 From: Tom Alsberg To: BASH Bugs Mailing List Message-ID: <20080106113030.GA86712@cs.huji.ac.il> References: <20071230152821.GA11196@cs.huji.ac.il> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: <20071230152821.GA11196@cs.huji.ac.il> X-Face: "5"j@Y1Peoz1; ftTv>\|['ox-csmV+:_RDNdi/2lSe2x?0:HVAeVW~ajwQ7RfDlcb^18eJ; t,O,s5-aNdU/DJ2E8h1s,..4}N9$27u`pWmH|; s!zlqqVwr9R^_ji=1\3}Z6gQBYyQ]{gd5-V8s^fYf{$V2*_&S>eA|SH@Y\hOVUjd[5eah{EO@gCr.ydSpJHJIU[QsH~bC?$C@O:SzF=CaUxp80-iknM(]q(W List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Jan 2008 11:30:42 -0000 Given the recent storm of applied patches from the list, I was wondering if anybody had the time to look at this one. Does it do the trick? Is the bug at all reproducible (with the script I quoted) elsewhere? If there is anything that should be changed in it, or inhibiting it from getting in, let me know. Thanks, -- Tom On Sun, Dec 30, 2007 at 05:28:21PM +0200, Tom Alsberg wrote: > Hi there. > > A curious issue I had with a shell script writes output to a pipe, > turns out (after quite a while of investigation, and noticing that > it works on systems where /bin/sh is not bash) to be due to the way > bash writes output on redirection. > > Some bash builtins (e.g. echo) write output using stdio functions > (e.g. printf, putchar), however redirection is performed at the Unix > file descriptor level (using dup). The thing is that since stdio > handles buffering on its own, output of builtins may go to the wrong > place if redirection is done. While bash correctly takes care to > flush the buffers after output in e.g. the echo builtin, it does not > handle the case of output failure. > > In case fflush fails, under some implementations, the output may > remain in the stdout buffer, and when printing something later, > after redirecting stdout to some file, the previous output (which > should not have gone to this file) will remain in the buffer, and be > printed together with the new output into the target file. > > I managed to reduce the bug to a simple example - take the following > script: > > #!/usr/bin/env bash > trap "" 1 > while true; do > echo "FOO" > echo "BAR" >> /tmp/barlog > done > > and run it within an xterm. As long as the terminal is still open, > all FOO output goes to the terminal, while all BAR output goes to > /tmp/barlog. Close the xterm, though, and (at least with glibc 2.7 > as the system C library), the FOO output will fail to go to the > terminal (which no longer exists), and will instead also go to > /tmp/barlog. > > I believe if the terminal was closed, one would expect output to it > to be discarded, and not go to some other unrelated file, where it > may interfere. If somebody can check this and let me know if you > can reproduce the problem, or confirm that this is indeed the > problem... > > It does not appear easy to fix the bug in a portable way, since in > general mixing I/O in the Unix file descriptor level and in the > stdio level is not so well defined. However, 4.4BSD-based systems > provide the fpurge function, and Solaris and glibc the (identical, > except for the return value) __fpurge function, which clears all > pending output in a stdio FILE * buffer. Calling those functions > when redirecting stdout/stderr solves the problem on systems where > they are supported - output that previously failed to go to stdout > will be discarded and not go to the redirect target. > > Attached is a small patch I wrote for bash-3.2 that (with a small > change to configure.in and config.h.in) checks for those functions > on configure, and if they are available uses them whenever > redirecting stdout/stderr. That seems to do the trick here, but let > me know if it works for you, or if there is a more correct way to do > this. > > I would be glad to have that patch applied to upstream bash - that > will save us the trouble of applying it locally every time. Of > course it would be even better to solve that problem in a more > portable manner, but I suspect that may require more substantial > modifications to parts of the code. > > Cheers, > -- Tom > > -- > Tom Alsberg - hacker (being the best description fitting this space) > Web page: http://www.cs.huji.ac.il/~alsbergt/ > DISCLAIMER: The above message does not even necessarily represent what > my fingers have typed on the keyboard, save anything further. > diff -ur bash-3.2.orig/config.h.in bash-3.2/config.h.in > --- bash-3.2.orig/config.h.in 2006-09-12 23:00:54.000000000 +0300 > +++ bash-3.2/config.h.in 2007-12-30 15:41:05.974625000 +0200 > @@ -812,6 +812,13 @@ > /* Define if you have the wcwidth function. */ > #undef HAVE_WCWIDTH > > +/* Define if you have the fpurge function. */ > +#undef HAVE_FPURGE > + > +/* Define if you have the __fpurge function. */ > +#undef HAVE___FPURGE > + > + > /* Presence of certain system include files. */ > > /* Define if you have the header file. */ > diff -ur bash-3.2.orig/configure.in bash-3.2/configure.in > --- bash-3.2.orig/configure.in 2006-09-26 18:05:45.000000000 +0300 > +++ bash-3.2/configure.in 2007-12-30 15:14:52.206078000 +0200 > @@ -721,6 +721,9 @@ > AC_CHECK_DECLS([strcpy]) > AC_CHECK_DECLS([strsignal]) > > +dnl checks for fpurge or __fpurge > +AC_CHECK_FUNCS(fpurge __fpurge) > + > dnl Extra test to detect the horribly broken HP/UX 11.00 strtold(3) > AC_CHECK_DECLS([strtold], [ > AC_MSG_CHECKING([for broken strtold]) > diff -ur bash-3.2.orig/redir.c bash-3.2/redir.c > --- bash-3.2.orig/redir.c 2006-05-24 05:31:35.000000000 +0300 > +++ bash-3.2/redir.c 2007-12-30 16:35:53.627539000 +0200 > @@ -31,6 +31,18 @@ > #include "filecntl.h" > #include "posixstat.h" > > + > +/* check for a way to clear the output buffer of a FILE *, for use > + after dup on stdout/stderr */ > +#undef FPURGE > +#ifdef HAVE___FPURGE > +#define FPURGE __fpurge > +#endif > +#ifdef HAVE_FPURGE > +#define FPURGE fpurge > +#endif > + > + > #if defined (HAVE_UNISTD_H) > # include > #endif > @@ -769,6 +781,19 @@ > if ((fd != redirector) && (dup2 (fd, redirector) < 0)) > return (errno); > > + > +/* if possible, and the redirecting stdout/stderr, clear the stdio > + output buffers, so output from shell builtins that previously > + failed will not go to the redirected file */ > +#ifdef FPURGE > + if (redirector == 1) { > + FPURGE(stdout); > + } else if (redirector == 2) { > + FPURGE(stderr); > + } > +#endif > + > + > #if defined (BUFFERED_INPUT) > /* Do not change the buffered stream for an implicit redirection > of /dev/null to fd 0 for asynchronous commands without job > @@ -851,6 +876,19 @@ > return (r); > } > > + > +/* if possible, and the redirecting stdout/stderr, clear the stdio > + output buffers, so output from shell builtins that previously > + failed will not go to the redirected file */ > +#ifdef FPURGE > + if (redirector == 1) { > + FPURGE(stdout); > + } else if (redirector == 2) { > + FPURGE(stderr); > + } > +#endif > + > + > #if defined (BUFFERED_INPUT) > duplicate_buffered_stream (fd, redirector); > #endif > @@ -890,6 +928,19 @@ > if (dup2 (redir_fd, redirector) < 0) > return (errno); > > + > +/* if possible, and the redirecting stdout/stderr, clear the stdio > + output buffers, so output from shell builtins that previously > + failed will not go to the redirected file */ > +#ifdef FPURGE > + if (redirector == 1) { > + FPURGE(stdout); > + } else if (redirector == 2) { > + FPURGE(stderr); > + } > +#endif > + > + > #if defined (BUFFERED_INPUT) > if (ri == r_duplicating_input || ri == r_move_input) > duplicate_buffered_stream (redir_fd, redirector); -- Tom Alsberg - hacker (being the best description fitting this space) Web page: http://www.cs.huji.ac.il/~alsbergt/ DISCLAIMER: The above message does not even necessarily represent what my fingers have typed on the keyboard, save anything further. From MAILER-DAEMON Sun Jan 06 08:34:43 2008 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1JBVeF-0004fz-6S for mharc-bug-bash@gnu.org; Sun, 06 Jan 2008 08:34:43 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JBVeD-0004fP-Bu for bug-bash@gnu.org; Sun, 06 Jan 2008 08:34:41 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JBVeB-0004eR-St for bug-bash@gnu.org; Sun, 06 Jan 2008 08:34:40 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JBVeB-0004eK-Mk for bug-bash@gnu.org; Sun, 06 Jan 2008 08:34:39 -0500 Received: from qmta06.westchester.pa.mail.comcast.net ([76.96.62.56]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JBVeB-0007Pr-Fq for bug-bash@gnu.org; Sun, 06 Jan 2008 08:34:39 -0500 Received: from OMTA08.westchester.pa.mail.comcast.net ([76.96.62.12]) by QMTA06.westchester.pa.mail.comcast.net with comcast id ZpBF1Y0010Fqzac0501200; Sun, 06 Jan 2008 13:34:39 +0000 Received: from [192.168.0.103] ([67.166.125.73]) by OMTA08.westchester.pa.mail.comcast.net with comcast id ZpaY1Y0011b8C2B3U00000; Sun, 06 Jan 2008 13:34:33 +0000 X-Authority-Analysis: v=1.0 c=1 a=xe8BsctaAAAA:8 a=XPgmhsIuUvHQ8W3NGbYA:9 a=BFMB0zCnVhsSLfp_kJOW-ddTBcEA:4 a=eDFNAWYWrCwA:10 a=rPt6xJ-oxjAA:10 Message-ID: <4780D8F6.303@byu.net> Date: Sun, 06 Jan 2008 06:34:46 -0700 From: Eric Blake User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.9) Gecko/20071031 Thunderbird/2.0.0.9 Mnenhy/0.7.5.666 MIME-Version: 1.0 To: Tom Alsberg References: <20071230152821.GA11196@cs.huji.ac.il> <20080106113030.GA86712@cs.huji.ac.il> In-Reply-To: <20080106113030.GA86712@cs.huji.ac.il> X-Enigmail-Version: 0.95.6 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-detected-kernel: by monty-python.gnu.org: Genre and OS details not recognized. Cc: BASH Bugs Mailing List Subject: Re: stdio buffer flushing on redirection X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Jan 2008 13:34:41 -0000 -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 According to Tom Alsberg on 1/6/2008 4:30 AM: | Given the recent storm of applied patches from the list, I was | wondering if anybody had the time to look at this one. Does it do the | trick? Is the bug at all reproducible (with the script I quoted) | elsewhere? If there is anything that should be changed in it, or | inhibiting it from getting in, let me know. Yes the bug is reproducible, and I've already reported it several months ago from the perspective of cygwin. My patch for cygwin used freopen(NULL,mode,stdout) instead of fpurge, with mode chosen correctly based on whether the underlying stream is in append mode, but that is equally unportable to other platforms. - -- Don't work too hard, make some time for fun as well! Eric Blake ebb9@byu.net -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.5 (Cygwin) Comment: Public key at home.comcast.net/~ericblake/eblake.gpg Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFHgNj284KuGfSFAYARAp81AJoDTcbBje8acNYfZC7LDZTJS8cyVQCeO8mf E4FQDM2TufD0YBXd0dpVWaY= =61fD -----END PGP SIGNATURE----- From MAILER-DAEMON Sun Jan 06 13:52:14 2008 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1JBabW-0002rR-4x for mharc-bug-bash@gnu.org; Sun, 06 Jan 2008 13:52:14 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JBabU-0002rC-2H for bug-bash@gnu.org; Sun, 06 Jan 2008 13:52:12 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JBabR-0002qc-0c for bug-bash@gnu.org; Sun, 06 Jan 2008 13:52:10 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JBabQ-0002qY-Tv for bug-bash@gnu.org; Sun, 06 Jan 2008 13:52:08 -0500 Received: from mpv4.tis.cwru.edu ([129.22.105.34]) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_3DES_EDE_CBC_SHA1:24) (Exim 4.60) (envelope-from ) id 1JBabQ-0007m9-L6 for bug-bash@gnu.org; Sun, 06 Jan 2008 13:52:08 -0500 Received: from mpv6.TIS.cwru.edu (mpv6.TIS.CWRU.Edu [129.22.104.221]) by mpv4.tis.cwru.edu (MOS 3.8.6-GA) with ESMTP id CGN51360; Sun, 6 Jan 2008 13:52:03 -0500 (EST) Received: from z4.local ([71.31.152.15]) by mpv6.TIS.cwru.edu (MOS 3.8.6-GA) with ESMTP id DPQ29575 (AUTH cpr); Sun, 6 Jan 2008 13:52:01 -0500 (EST) Message-ID: <47812350.10204@case.edu> Date: Sun, 06 Jan 2008 13:52:00 -0500 From: Chet Ramey Organization: ITS, Case Western Reserve University User-Agent: Thunderbird 2.0.0.9 (Macintosh/20071031) MIME-Version: 1.0 To: Tom Alsberg References: <20071230152821.GA11196@cs.huji.ac.il> <20080106113030.GA86712@cs.huji.ac.il> In-Reply-To: <20080106113030.GA86712@cs.huji.ac.il> X-Enigmail-Version: 0.95.5 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Junkmail-Status: score=10/49, host=mpv4.tis.cwru.edu X-Junkmail-SD-Raw: score=unknown, refid=str=0001.0A090203.47812352.0157,ss=1,fgs=0, ip=71.31.152.15, so=2007-10-30 19:00:17, dmn=5.4.3/2007-11-16 X-Junkmail-IWF: false X-detected-kernel: by monty-python.gnu.org: Genre and OS details not recognized. Cc: BASH Bugs Mailing List , chet@case.edu Subject: Re: stdio buffer flushing on redirection X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: chet.ramey@case.edu List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Jan 2008 18:52:12 -0000 Tom Alsberg wrote: > Given the recent storm of applied patches from the list, I was > wondering if anybody had the time to look at this one. Does it do the > trick? Is the bug at all reproducible (with the script I quoted) > elsewhere? If there is anything that should be changed in it, or > inhibiting it from getting in, let me know. I fixed it in a similar, though slightly different, way for the next release. Chet -- ``The lyf so short, the craft so long to lerne.'' - Chaucer Live Strong. No day but today. Chet Ramey, ITS, CWRU chet@case.edu http://cnswww.cns.cwru.edu/~chet/ From MAILER-DAEMON Sun Jan 06 14:11:06 2008 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1JBatm-0008M2-6J for mharc-bug-bash@gnu.org; Sun, 06 Jan 2008 14:11:06 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JBatj-0008HN-Sc for bug-bash@gnu.org; Sun, 06 Jan 2008 14:11:03 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JBath-0008EH-TZ for bug-bash@gnu.org; Sun, 06 Jan 2008 14:11:02 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JBath-0008E9-Pq for bug-bash@gnu.org; Sun, 06 Jan 2008 14:11:01 -0500 Received: from mpv2.tis.cwru.edu ([129.22.105.37]) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_3DES_EDE_CBC_SHA1:24) (Exim 4.60) (envelope-from ) id 1JBath-00021O-Hk for bug-bash@gnu.org; Sun, 06 Jan 2008 14:11:01 -0500 Received: from mpv5.TIS.cwru.edu (mpv5.TIS.CWRU.Edu [129.22.105.51]) by mpv2.tis.cwru.edu (MOS 3.8.6-GA) with ESMTP id CPU52282; Sun, 6 Jan 2008 14:11:00 -0500 (EST) Received: from z4.local ([71.31.152.15]) by mpv5.TIS.cwru.edu (MOS 3.8.6-GA) with ESMTP id DPI37295 (AUTH cpr); Sun, 6 Jan 2008 14:10:58 -0500 (EST) Message-ID: <478127C1.4060809@case.edu> Date: Sun, 06 Jan 2008 14:10:57 -0500 From: Chet Ramey Organization: ITS, Case Western Reserve University User-Agent: Thunderbird 2.0.0.9 (Macintosh/20071031) MIME-Version: 1.0 To: jidanni@jidanni.org References: <87ir2d9odn.fsf@jidanni.org> In-Reply-To: <87ir2d9odn.fsf@jidanni.org> X-Enigmail-Version: 0.95.5 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Junkmail-Status: score=10/49, host=mpv2.tis.cwru.edu X-Junkmail-SD-Raw: score=unknown, refid=str=0001.0A090203.478127C4.013B,ss=1,fgs=0, ip=71.31.152.15, so=2007-10-30 19:00:17, dmn=5.4.3/2007-11-16 X-Junkmail-IWF: false X-detected-kernel: by monty-python.gnu.org: Genre and OS details not recognized. Cc: bug-bash@gnu.org, chet@case.edu Subject: Re: ESC . vs. ^R, ^P again X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: chet.ramey@case.edu List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Jan 2008 19:11:04 -0000 jidanni@jidanni.org wrote: > As there years pass I use ESC . daily hoping that it will get the last > chunk of the previous line on my screen, despite any ^P's or ^R's I > might have done. > > Never have I wanted it to consider those ^P's and ^R's. Since there are two key sequences pre-bound to yank-last-arg, why not create a macro that first performs M-> (to take you to the end of the history), then invokes M-_ to yank the last argument of the last command? Something like "\M-.":"\M->\M-_" would probably get you started. The macro facility offers you a lot of flexibility. Chet -- ``The lyf so short, the craft so long to lerne.'' - Chaucer Live Strong. No day but today. Chet Ramey, ITS, CWRU chet@case.edu http://cnswww.cns.cwru.edu/~chet/ From MAILER-DAEMON Mon Jan 07 04:35:33 2008 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1JBoOL-0008Qy-OH for mharc-bug-bash@gnu.org; Mon, 07 Jan 2008 04:35:33 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JBiuw-0004iV-15 for bug-bash@gnu.org; Sun, 06 Jan 2008 22:44:50 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JBiuu-0004hl-TX for bug-bash@gnu.org; Sun, 06 Jan 2008 22:44:49 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JBiuu-0004hc-MY for bug-bash@gnu.org; Sun, 06 Jan 2008 22:44:48 -0500 Received: from fg-out-1718.google.com ([72.14.220.155]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JBiuu-0006rX-AF for bug-bash@gnu.org; Sun, 06 Jan 2008 22:44:48 -0500 Received: by fg-out-1718.google.com with SMTP id d23so4597499fga.30 for ; Sun, 06 Jan 2008 19:44:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:user-agent:mime-version:to:subject:content-type:content-transfer-encoding:from; bh=DkPLsuPkXo798So3SRVc3X999qEwvpaVPjIdV34MKRc=; b=f3Kau5slXU1bM0awI43bBRhWjWyuB0k2Zwnjwav9653VxvX7Z2cy51ZuXnKGXFzO+y2ID17KhSeFCGmNngp3O94JGew9YclGRM5WhNYULmiAS1R/mtmeHS94PqB3zLVYN6Pc064+T4IYbV9wmi7oxqJOP8JaXjTVpBqKjKuJ+y0= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:user-agent:mime-version:to:subject:content-type:content-transfer-encoding:from; b=OnLgeTRuj7kLjyC2v5RUVcePBEuzwCHIkacDDoGb1ctx9kH4k9UOPWOFvVkso3uL/QuaXyVQaVRaaE6mettRYyds9+uFoWK1TV57+VtaT5cnlcdAgla332/MzZ9DmcvvFRwiJHF4lvRpJBoooBVxA243T3xHLFTh5oYJyoPRRNE= Received: by 10.86.84.5 with SMTP id h5mr19652652fgb.53.1199677487540; Sun, 06 Jan 2008 19:44:47 -0800 (PST) Received: from ?192.168.2.50? ( [79.196.222.227]) by mx.google.com with ESMTPS id d13sm27564376fka.16.2008.01.06.19.44.45 (version=SSLv3 cipher=RC4-MD5); Sun, 06 Jan 2008 19:44:46 -0800 (PST) Message-ID: <4781A02C.4080405@gmail.com> Date: Mon, 07 Jan 2008 04:44:44 +0100 User-Agent: Thunderbird 2.0.0.9 (X11/20071031) MIME-Version: 1.0 To: bug-bash@gnu.org, bash@packages.debian.org Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit From: Lea Wiemann X-detected-kernel: by monty-python.gnu.org: Linux 2.6 (newer, 2) X-Mailman-Approved-At: Mon, 07 Jan 2008 04:35:31 -0500 Cc: Subject: Sub-arrays do not work with non-blank IFS X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Jan 2008 03:44:50 -0000 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' -DCONF_VENDOR='pc' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash' -DSHELL -DHAVE_CONFIG_H -I. -I../bash -I../bash/include -I../bash/lib -g -O2 uname output: Linux fly 2.6.22-3-686 #1 SMP Mon Nov 12 08:32:57 UTC 2007 i686 GNU/Linux Machine Type: i486-pc-linux-gnu Bash Version: 3.1 Patch Level: 17 Release Status: release Description: If the IFS does not contain a blank, copying an array using ("${array[@]}") works, but creating a sub-array using ("${array[@]:offset:length}") does not work. Repeat-By: IFS=$'\n' a=(A B C D) b=("${a[@]}") echo "${#b[@]}", "${b[@]}" # 4, A B C D -- OK b=("${a[@]:2}") echo "${#b[@]}", "${b[@]}" # 1, C D -- bug, should be 2, C D From MAILER-DAEMON Mon Jan 07 04:35:33 2008 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1JBoOL-0008QZ-G1 for mharc-bug-bash@gnu.org; Mon, 07 Jan 2008 04:35:33 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JBhJh-0008LK-N6 for bug-bash@gnu.org; Sun, 06 Jan 2008 21:02:17 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JBhJg-0008Ke-Ri for bug-bash@gnu.org; Sun, 06 Jan 2008 21:02:17 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JBhJg-0008KZ-MK for bug-bash@gnu.org; Sun, 06 Jan 2008 21:02:16 -0500 Received: from fg-out-1718.google.com ([72.14.220.159]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JBhJg-0000zL-7Y for bug-bash@gnu.org; Sun, 06 Jan 2008 21:02:16 -0500 Received: by fg-out-1718.google.com with SMTP id d23so4581409fga.30 for ; Sun, 06 Jan 2008 18:02:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:received:to:subject:message-id:date:from; bh=MolnrR86kmPHSDBIfqCDQ1gTw03dVxwq59nfAhFHRuY=; b=SmBE0xgWNJgtal100fuNmZ+OmMXJhbQRy6F0VjEgXta9TXntRwg7myJbVB/d2jjwLuzAor2xYwGsoWZScpXAoRICl5XEM4erPGU4O48+siztKjcDMoLFi//1+f+giJcN/X/BCxlzirRm8IbIrghq/c5yAQLdTQ0vhZW9bKjN7mE= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=to:subject:message-id:date:from; b=pF+3SR0ClvaITTwaSgoLWWkj2WsgI78bV2w+na6JrnDNmWv9+mKg2pESNUFFtxlUMGUS1qh0E4Ty80Ax4eun6+qL7JdDE+0H6QL/y2eUPEMrKfpiDNWtSDm90JfeNocXK3TIzxqt7TKKjZs35nYGF22MtJjWopwEx3//1G4mX78= Received: by 10.86.97.7 with SMTP id u7mr19566251fgb.65.1199671334884; Sun, 06 Jan 2008 18:02:14 -0800 (PST) Received: from fly ( [79.196.222.227]) by mx.google.com with ESMTPS id 12sm22151396fgg.6.2008.01.06.18.02.11 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 06 Jan 2008 18:02:12 -0800 (PST) Received: from lea by fly with local (Exim 4.68) (envelope-from ) id 1JBhJV-0003qv-0B; Mon, 07 Jan 2008 03:02:05 +0100 To: bug-bash@gnu.org,bash@packages.debian.org Message-Id: Date: Mon, 07 Jan 2008 03:02:05 +0100 From: Lea Wiemann X-detected-kernel: by monty-python.gnu.org: Linux 2.6 (newer, 2) X-Mailman-Approved-At: Mon, 07 Jan 2008 04:35:30 -0500 Cc: Subject: ${array[@]:offset:length} problem with non-blank IFS X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Jan 2008 02:02:17 -0000 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' -DCONF_VENDOR='pc' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash' -DSHELL -DHAVE_CONFIG_H -I. -I../bash -I../bash/include -I../bash/lib -g -O2 uname output: Linux fly 2.6.22-3-686 #1 SMP Mon Nov 12 08:32:57 UTC 2007 i686 GNU/Linux Machine Type: i486-pc-linux-gnu Bash Version: 3.1 Patch Level: 17 Release Status: release Description: When IFS does not contain the blank character, var="(${array[@]})" works fine, but var="(${array[@]:offset:length})" does not (it creates a single-element array). Repeat-By: IFS=$'\n' a=(A B C D) b=("${a[@]}") echo "${#b[@]}", "${b[@]}" # 4, A B C D -- OK b=("${a[@]:2}") echo "${#b[@]}", "${b[@]}" # 1, C D -- bug, should be 2, C D From MAILER-DAEMON Mon Jan 07 14:20:30 2008 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1JBxWQ-0000nn-5m for mharc-bug-bash@gnu.org; Mon, 07 Jan 2008 14:20:30 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JBxWO-0000ms-JA for bug-bash@gnu.org; Mon, 07 Jan 2008 14:20:28 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JBxWO-0000mU-2e for bug-bash@gnu.org; Mon, 07 Jan 2008 14:20:28 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JBxWN-0000mR-Su for bug-bash@gnu.org; Mon, 07 Jan 2008 14:20:27 -0500 Received: from lax-green-bigip-5.dreamhost.com ([208.113.200.5] helo=blingymail-a1.g.dreamhost.com) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JBxWN-00024q-MP for bug-bash@gnu.org; Mon, 07 Jan 2008 14:20:27 -0500 Received: from jidanni1 (122-127-41-71.dynamic.hinet.net [122.127.41.71]) by blingymail-a1.g.dreamhost.com (Postfix) with ESMTP id E27E85CFAE for ; Mon, 7 Jan 2008 11:19:49 -0800 (PST) To: bug-bash@gnu.org References: <478127C1.4060809@case.edu> From: jidanni@jidanni.org Date: Tue, 08 Jan 2008 03:16:59 +0800 Message-ID: <874pdpwims.fsf@jidanni.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-detected-kernel: by monty-python.gnu.org: Linux 2.4-2.6 Subject: Re: ESC . vs. ^R, ^P again X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Jan 2008 19:20:29 -0000 C> "\M-.":"\M->\M-_" Thanks but that doesn't work. $ : 1 $ : 2 $ : 3 $ : 4 $ I want now typing ^R 2 ^E M-. to put a 4 at the end of the line but the above macro does not. From MAILER-DAEMON Mon Jan 07 15:49:36 2008 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1JByue-0001hh-P0 for mharc-bug-bash@gnu.org; Mon, 07 Jan 2008 15:49:36 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JByud-0001hU-19 for bug-bash@gnu.org; Mon, 07 Jan 2008 15:49:35 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JByub-0001hI-AX for bug-bash@gnu.org; Mon, 07 Jan 2008 15:49:34 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JByub-0001hF-3x for bug-bash@gnu.org; Mon, 07 Jan 2008 15:49:33 -0500 Received: from mpv4.tis.cwru.edu ([129.22.105.34]) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_3DES_EDE_CBC_SHA1:24) (Exim 4.60) (envelope-from ) id 1JByua-0004SY-D3 for bug-bash@gnu.org; Mon, 07 Jan 2008 15:49:32 -0500 Received: from mpv6.TIS.cwru.edu (mpv6.TIS.CWRU.Edu [129.22.104.221]) by mpv4.tis.cwru.edu (MOS 3.8.6-GA) with ESMTP id CGN91118; Mon, 7 Jan 2008 15:49:22 -0500 (EST) Received: from caleb.ins.cwru.edu (caleb.INS.CWRU.Edu [129.22.8.211]) by mpv6.TIS.cwru.edu (MOS 3.8.6-GA) with ESMTP id DPV56791 (AUTH cpr); Mon, 7 Jan 2008 15:49:21 -0500 (EST) Message-ID: <47829051.1070703@case.edu> Date: Mon, 07 Jan 2008 15:49:21 -0500 From: Chet Ramey Organization: ITS, Case Western Reserve University User-Agent: Thunderbird 2.0.0.9 (Macintosh/20071031) MIME-Version: 1.0 To: jidanni@jidanni.org References: <478127C1.4060809@case.edu> <874pdpwims.fsf@jidanni.org> In-Reply-To: <874pdpwims.fsf@jidanni.org> X-Enigmail-Version: 0.95.5 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Junkmail-Status: score=10/49, host=mpv4.tis.cwru.edu X-Junkmail-SD-Raw: score=unknown, refid=str=0001.0A090207.47829051.01E1:SCFMA1096267,ss=1,fgs=0, ip=129.22.104.221, so=2007-10-30 19:00:17, dmn=5.4.3/2007-11-16 X-Junkmail-IWF: false X-detected-kernel: by monty-python.gnu.org: Genre and OS details not recognized. Cc: bug-bash@gnu.org, chet@case.edu Subject: Re: ESC . vs. ^R, ^P again X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: chet.ramey@case.edu List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Jan 2008 20:49:35 -0000 jidanni@jidanni.org wrote: > C> "\M-.":"\M->\M-_" > Thanks but that doesn't work. > $ : 1 > $ : 2 > $ : 3 > $ : 4 > $ > I want now typing ^R 2 ^E M-. to put a 4 at the end of the line but > the above macro does not. Try bind '"\e.":"\e>\e_"' That worked for me when I used it, since I use ESC as the meta-prefix. Chet -- ``The lyf so short, the craft so long to lerne.'' - Chaucer Live Strong. No day but today. Chet Ramey, ITS, CWRU chet@case.edu http://cnswww.cns.cwru.edu/~chet/ From MAILER-DAEMON Mon Jan 07 16:12:38 2008 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1JBzGw-00051W-A3 for mharc-bug-bash@gnu.org; Mon, 07 Jan 2008 16:12:38 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JBzGt-00050F-FP for bug-bash@gnu.org; Mon, 07 Jan 2008 16:12:35 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JBzGs-0004zh-2e for bug-bash@gnu.org; Mon, 07 Jan 2008 16:12:35 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JBzGr-0004zc-Oj for bug-bash@gnu.org; Mon, 07 Jan 2008 16:12:33 -0500 Received: from lax-green-bigip-5.dreamhost.com ([208.113.200.5] helo=blingymail-a1.g.dreamhost.com) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JBzGr-0000xh-JN for bug-bash@gnu.org; Mon, 07 Jan 2008 16:12:33 -0500 Received: from jidanni1 (122-127-41-71.dynamic.hinet.net [122.127.41.71]) by blingymail-a1.g.dreamhost.com (Postfix) with ESMTP id C21B75CDCE for ; Mon, 7 Jan 2008 13:12:31 -0800 (PST) To: bug-bash@gnu.org References: <47829051.1070703@case.edu> From: jidanni@jidanni.org Date: Tue, 08 Jan 2008 05:12:23 +0800 Message-ID: <87bq7xuyq0.fsf@jidanni.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-detected-kernel: by monty-python.gnu.org: Linux 2.4-2.6 Subject: Re: ESC . vs. ^R, ^P again X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Jan 2008 21:12:35 -0000 $ bind '"\e.":"\e>\e_"' $ : 1 $ : 2 $ : 3 $ : 4 $ >> I want now typing ^R 2 ^E M-. to put a 4 at the end of the line... ...and not wipe out the 2, which is what the above bind did. BASH_VERSION='3.1.17(1)-release' From MAILER-DAEMON Mon Jan 07 16:21:05 2008 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1JBzP7-00052r-7A for mharc-bug-bash@gnu.org; Mon, 07 Jan 2008 16:21:05 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JBzP5-00052g-El for bug-bash@gnu.org; Mon, 07 Jan 2008 16:21:03 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JBzP4-00052L-2N for bug-bash@gnu.org; Mon, 07 Jan 2008 16:21:03 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JBzP3-00052H-Rr for bug-bash@gnu.org; Mon, 07 Jan 2008 16:21:01 -0500 Received: from mpv4.tis.cwru.edu ([129.22.105.34]) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_3DES_EDE_CBC_SHA1:24) (Exim 4.60) (envelope-from ) id 1JBzP3-0002lS-Nu for bug-bash@gnu.org; Mon, 07 Jan 2008 16:21:01 -0500 Received: from mpv5.TIS.cwru.edu (mpv5.TIS.CWRU.Edu [129.22.105.51]) by mpv4.tis.cwru.edu (MOS 3.8.6-GA) with ESMTP id CGN92382; Mon, 7 Jan 2008 16:21:00 -0500 (EST) Received: from caleb.ins.cwru.edu (caleb.INS.CWRU.Edu [129.22.8.211]) by mpv5.TIS.cwru.edu (MOS 3.8.6-GA) with ESMTP id DPN83086 (AUTH cpr); Mon, 7 Jan 2008 16:20:59 -0500 (EST) Message-ID: <478297BB.8010700@case.edu> Date: Mon, 07 Jan 2008 16:20:59 -0500 From: Chet Ramey Organization: ITS, Case Western Reserve University User-Agent: Thunderbird 2.0.0.9 (Macintosh/20071031) MIME-Version: 1.0 To: jidanni@jidanni.org References: <47829051.1070703@case.edu> <87bq7xuyq0.fsf@jidanni.org> In-Reply-To: <87bq7xuyq0.fsf@jidanni.org> X-Enigmail-Version: 0.95.5 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Junkmail-Status: score=10/49, host=mpv4.tis.cwru.edu X-Junkmail-SD-Raw: score=unknown, refid=str=0001.0A090207.478297BD.0004,ss=1,fgs=0, ip=129.22.105.51, so=2007-10-30 19:00:17, dmn=5.4.3/2007-11-16 X-Junkmail-IWF: false X-detected-kernel: by monty-python.gnu.org: Genre and OS details not recognized. Cc: bug-bash@gnu.org, chet@case.edu Subject: Re: ESC . vs. ^R, ^P again X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: chet.ramey@case.edu List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Jan 2008 21:21:03 -0000 jidanni@jidanni.org wrote: > $ bind '"\e.":"\e>\e_"' > $ : 1 > $ : 2 > $ : 3 > $ : 4 > $ >>> I want now typing ^R 2 ^E M-. to put a 4 at the end of the line... > ...and not wipe out the 2, which is what the above bind did. OK, you're not going to be able to do that, since you're moving away from the line containing the `2'. Chet -- ``The lyf so short, the craft so long to lerne.'' - Chaucer Live Strong. No day but today. Chet Ramey, ITS, CWRU chet@case.edu http://cnswww.cns.cwru.edu/~chet/ From MAILER-DAEMON Mon Jan 07 23:38:02 2008 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1JC6Dx-0001Am-Px for mharc-bug-bash@gnu.org; Mon, 07 Jan 2008 23:38:01 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JBzHL-0005IM-UZ for bug-bash@gnu.org; Mon, 07 Jan 2008 16:13:03 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JBzHI-0005Gm-6Q for bug-bash@gnu.org; Mon, 07 Jan 2008 16:13:02 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JBzHI-0005Gj-3G for bug-bash@gnu.org; Mon, 07 Jan 2008 16:13:00 -0500 Received: from smtp20.orange.fr ([193.252.22.29]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JBzHH-00012C-O2 for bug-bash@gnu.org; Mon, 07 Jan 2008 16:13:00 -0500 Received: from me-wanadoo.net (localhost [127.0.0.1]) by mwinf2016.orange.fr (SMTP Server) with ESMTP id ABF2E1C000AC for ; Mon, 7 Jan 2008 22:12:57 +0100 (CET) Received: from [192.168.1.10] (ADijon-156-1-140-53.w90-56.abo.wanadoo.fr [90.56.171.53]) by mwinf2016.orange.fr (SMTP Server) with ESMTP id 60EFF1C000AB for ; Mon, 7 Jan 2008 22:12:57 +0100 (CET) X-ME-UUID: 20080107211257397.60EFF1C000AB@mwinf2016.orange.fr From: sibelius Organization: JLPRAC To: bug-bash@gnu.org Date: Mon, 7 Jan 2008 22:12:51 +0100 User-Agent: KMail/1.9.6 (enterprise 0.20070907.709405) MIME-Version: 1.0 Content-Type: Multipart/Mixed; boundary="Boundary-00=_TXpgHwu/NmmxOJH" Message-Id: <200801072212.51713.horiane@orange.fr> X-detected-kernel: by monty-python.gnu.org: Linux 2.4-2.6 X-Mailman-Approved-At: Mon, 07 Jan 2008 23:38:00 -0500 Subject: bug kde kubuntu v7.10 X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Jan 2008 21:13:04 -0000 --Boundary-00=_TXpgHwu/NmmxOJH Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Bonjour, de France : Apr=E8s installation de Kubuntu, puis t=E9l=E9chargement et installation d= e=20 79 mises =E0 jour , puis install de ClamAV et Firestarter , blocage de ADEP= T. Kmail sous root seulement avec impossibilit=E9 d'ouvrir Kontact et donc de= =20 configurer Kmail. J'ai d=E9sinstall=E9 Adept puis r=E9install=E9 Adept avec le terminal. OK j'ai modif=E9l es permissions du dossier et sous-dossiers Kmail avec le =20 terminal . OK tout semble rentr=E9 dans l'ordre ( je n'ai pas eu ce probl=E8me avec Ubun= tu=20 7.10 ) horiane............ --Boundary-00=_TXpgHwu/NmmxOJH Content-Type: text/plain; charset="us-ascii"; name="Adept_erreurs" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="Adept_erreurs" (no debugging symbols found) Using host libthread_db library "/lib/tls/i686/cmov/libthread_db.so.1". (no debugging symbols found) (no debugging symbols found) (no debugging symbols found) (no debugging symbols found) (no debugging symbols found) (no debugging symbols found) (no debugging symbols found) (no debugging symbols found) (no debugging symbols found) (no debugging symbols found) (no debugging symbols found) (no debugging symbols found) (no debugging symbols found) (no debugging symbols found) (no debugging symbols found) (no debugging symbols found) (no debugging symbols found) (no debugging symbols found) (no debugging symbols found) (no debugging symbols found) (no debugging symbols found) (no debugging symbols found) (no debugging symbols found) (no debugging symbols found) (no debugging symbols found) (no debugging symbols found) (no debugging symbols found) (no debugging symbols found) (no debugging symbols found) (no debugging symbols found) (no debugging symbols found) (no debugging symbols found) (no debugging symbols found) [Thread debugging using libthread_db enabled] [New Thread -1235720512 (LWP 14962)] (no debugging symbols found) (no debugging symbols found) (no debugging symbols found) (no debugging symbols found) (no debugging symbols found) (no debugging symbols found) (no debugging symbols found) (no debugging symbols found) (no debugging symbols found) (no debugging symbols found) (no debugging symbols found) (no debugging symbols found) (no debugging symbols found) (no debugging symbols found) (no debugging symbols found) (no debugging symbols found) (no debugging symbols found) (no debugging symbols found) (no debugging symbols found) (no debugging symbols found) (no debugging symbols found) (no debugging symbols found) (no debugging symbols found) [KCrash handler] #6 0xffffe410 in __kernel_vsyscall () #7 0xb65e1875 in raise () from /lib/tls/i686/cmov/libc.so.6 #8 0xb65e3201 in abort () from /lib/tls/i686/cmov/libc.so.6 #9 0xb67ed6e0 in __gnu_cxx::__verbose_terminate_handler () from /usr/lib/libstdc++.so.6 #10 0xb67eaf65 in ?? () from /usr/lib/libstdc++.so.6 #11 0xb67eafa2 in std::terminate () from /usr/lib/libstdc++.so.6 #12 0xb67eb0ca in __cxa_throw () from /usr/lib/libstdc++.so.6 #13 0x0812b916 in ?? () #14 0x0812be8a in ?? () #15 0x0812bee8 in ?? () #16 0x0812c735 in ?? () #17 0x0812a22d in ?? () #18 0x08114379 in ?? () #19 0x080951ed in ?? () #20 0x0807378d in ?? () #21 0x0807408e in ?? () #22 0xb6e31893 in QObject::activate_signal () from /usr/lib/libqt-mt.so.3 #23 0xb71bd8ec in QSignal::signal () from /usr/lib/libqt-mt.so.3 #24 0xb6e51842 in QSignal::activate () from /usr/lib/libqt-mt.so.3 #25 0xb6e59258 in QSingleShotTimer::event () from /usr/lib/libqt-mt.so.3 #26 0xb6dc8af0 in QApplication::internalNotify () from /usr/lib/libqt-mt.so.3 #27 0xb6dca91f in QApplication::notify () from /usr/lib/libqt-mt.so.3 #28 0xb758eca2 in KApplication::notify () from /usr/lib/libkdecore.so.4 #29 0xb6d5b209 in QApplication::sendEvent () from /usr/lib/libqt-mt.so.3 #30 0xb6dbb53b in QEventLoop::activateTimers () from /usr/lib/libqt-mt.so.3 #31 0xb6d6fd49 in QEventLoop::processEvents () from /usr/lib/libqt-mt.so.3 #32 0xb6de31ce in QEventLoop::enterLoop () from /usr/lib/libqt-mt.so.3 #33 0xb6de2fde in QEventLoop::exec () from /usr/lib/libqt-mt.so.3 #34 0xb6dca699 in QApplication::exec () from /usr/lib/libqt-mt.so.3 #35 0x0806f75e in ?? () #36 0xb65cd050 in __libc_start_main () from /lib/tls/i686/cmov/libc.so.6 #37 0x0806f401 in ?? () --Boundary-00=_TXpgHwu/NmmxOJH-- From MAILER-DAEMON Tue Jan 08 00:59:25 2008 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1JC7Uj-0002N5-4q for mharc-bug-bash@gnu.org; Tue, 08 Jan 2008 00:59:25 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JC7Uh-0002LA-3n for bug-bash@gnu.org; Tue, 08 Jan 2008 00:59:23 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JC7Uf-0002Ih-1b for bug-bash@gnu.org; Tue, 08 Jan 2008 00:59:22 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JC7Ue-0002IG-Hy for bug-bash@gnu.org; Tue, 08 Jan 2008 00:59:20 -0500 Received: from hs-out-0708.google.com ([64.233.178.246] helo=hs-out-2122.google.com) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JC7Ue-0001nf-5K for bug-bash@gnu.org; Tue, 08 Jan 2008 00:59:20 -0500 Received: by hs-out-2122.google.com with SMTP id 55so6019980hsc.10 for ; Mon, 07 Jan 2008 21:59:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; bh=gkmQMgmlJi3ZAQewakVurhtyucTK8Z+LM4bGiT7wK40=; b=Og7qVB+HGQ8bEne6GZl29nBgydxoYtnm2/KH5R0ctQkZ9QabltsVL7wt79omqE5Vv4V4vh/4Eq76yqqewqPXGejX/j7R5Olch3s6La2e/czFKchcFRZ9f4XKz0oMp11Mcgo4Clgzk/kdWLSGSwXOospiEUc0JR1cOcL9VdKWV1c= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=WSzJSJUPfASzdTNVtVWeZ+c3IN09S+fWpbEg7PgJscToK4KMR+9azmMgZsFKbFrlw7i98S71R2kQfUzPumM/aMQ+XD2tHv8r/NWi7VwYRENtshE85WWIi28YVTL9otu8qzhpGBp+lCdR03AKPSxrrJmBw8TfZfFnIjmGVeYBI5Y= Received: by 10.150.140.6 with SMTP id n6mr885516ybd.42.1199771959102; Mon, 07 Jan 2008 21:59:19 -0800 (PST) Received: by 10.150.146.15 with HTTP; Mon, 7 Jan 2008 21:59:19 -0800 (PST) Message-ID: Date: Tue, 8 Jan 2008 07:59:19 +0200 From: "Pierre Gaston" To: sibelius In-Reply-To: <200801072212.51713.horiane@orange.fr> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <200801072212.51713.horiane@orange.fr> X-detected-kernel: by monty-python.gnu.org: Linux 2.4-2.6 (Google crawlbot) Cc: bug-bash@gnu.org Subject: Re: bug kde kubuntu v7.10 X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Jan 2008 05:59:23 -0000 Bonjour, Cependant ce mail semble assez hors sujet sur cette liste, adresse toi plut=F4t =E0 une liste concernant kubuntu, ou envoie un e-mail au maintainer d'adept pour kubuntu. Pierre. On Jan 7, 2008 11:12 PM, sibelius wrote: > Bonjour, > de France : > > Apr=E8s installation de Kubuntu, puis t=E9l=E9chargement et installation= de > 79 mises =E0 jour , puis install de ClamAV et Firestarter , blocage de AD= EPT. > > Kmail sous root seulement avec impossibilit=E9 d'ouvrir Kontact et donc = de > configurer Kmail. > > J'ai d=E9sinstall=E9 Adept puis r=E9install=E9 Adept avec le terminal. O= K > j'ai modif=E9l es permissions du dossier et sous-dossiers Kmail avec le > terminal . OK > > tout semble rentr=E9 dans l'ordre ( je n'ai pas eu ce probl=E8me avec Ub= untu > 7.10 ) > > horiane............ > From MAILER-DAEMON Tue Jan 08 08:54:38 2008 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1JCEuc-0001yY-No for mharc-bug-bash@gnu.org; Tue, 08 Jan 2008 08:54:38 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JCEub-0001wH-1B for bug-bash@gnu.org; Tue, 08 Jan 2008 08:54:37 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JCEua-0001vA-Gr for Bug-bash@gnu.org; Tue, 08 Jan 2008 08:54:36 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JCEua-0001v1-EB for Bug-bash@gnu.org; Tue, 08 Jan 2008 08:54:36 -0500 Received: from kuber.nabble.com ([216.139.236.158]) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1JCEua-0005j2-29 for Bug-bash@gnu.org; Tue, 08 Jan 2008 08:54:36 -0500 Received: from isper.nabble.com ([192.168.236.156]) by kuber.nabble.com with esmtp (Exim 4.63) (envelope-from ) id 1JCEuZ-0002UM-26 for Bug-bash@gnu.org; Tue, 08 Jan 2008 05:54:35 -0800 Message-ID: <14690151.post@talk.nabble.com> Date: Tue, 8 Jan 2008 05:54:35 -0800 (PST) From: Matthew_S To: Bug-bash@gnu.org In-Reply-To: <14575394.post@talk.nabble.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Nabble-From: M_Sleaford@hotmail.com References: <14575394.post@talk.nabble.com> X-detected-kernel: by monty-python.gnu.org: Linux 2.6 (newer, 3) Cc: Subject: Re: Taking input line by line from a config file in Bash X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Jan 2008 13:54:37 -0000 I'm having a bit of trouble with one of the lines in my config file. 'ls -l | cut -d ' ' -f1' doesn't want to pass through the script. Here's the output; ls -l | cut -d ' ' -f1 ls: |: No such file or directory ls: cut: No such file or directory ls: ': No such file or directory ls: ': No such file or directory It seems to think I want to do an ls on the | etc. and isn't treating the line as a command as a whole like all the other commands are treated. I've tried placing it in '' "" & `` but none of those work. I'm not sure how to get this line through? -- View this message in context: http://www.nabble.com/Taking-input-line-by-line-from-a-config-file-in-Bash-tp14575394p14690151.html Sent from the Gnu - Bash mailing list archive at Nabble.com. From MAILER-DAEMON Thu Jan 10 08:13:20 2008 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1JCxDk-0000zt-3l for mharc-bug-bash@gnu.org; Thu, 10 Jan 2008 08:13:20 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JCxDi-0000xm-Q2 for bug-bash@gnu.org; Thu, 10 Jan 2008 08:13:18 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JCxDg-0000uJ-Gl for bug-bash@gnu.org; Thu, 10 Jan 2008 08:13:18 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JCxDg-0000uC-Ao for bug-bash@gnu.org; Thu, 10 Jan 2008 08:13:16 -0500 Received: from smtp-out0.tiscali.nl ([195.241.79.175]) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1JCxDf-0000Di-V5 for bug-bash@gnu.org; Thu, 10 Jan 2008 08:13:16 -0500 Received: from [195.241.250.239] (helo=pubserv1.fransdb.nl) by smtp-out0.tiscali.nl with esmtp (Tiscali http://www.tiscali.nl) id 1JCxDd-0005Cv-0e for ; Thu, 10 Jan 2008 14:13:13 +0100 Received: from localhost (localhost [127.0.0.1]) by pubserv1.fransdb.nl (Postfix) with ESMTP id AE44716EF6 for ; Thu, 10 Jan 2008 11:31:53 +0100 (CET) X-Virus-Scanned: amavisd-new at fransdb.nl Received: from pubserv1.fransdb.nl ([127.0.0.1]) by localhost (pubserv1.fransdb.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id mkis0ApvOvt0 for ; Thu, 10 Jan 2008 11:31:50 +0100 (CET) Received: from [192.168.49.26] (unknown [192.168.49.2]) by pubserv1.fransdb.nl (Postfix) with ESMTP id 47A2D16EF5 for ; Thu, 10 Jan 2008 11:31:50 +0100 (CET) From: Frans de Boer To: bug-bash@gnu.org Content-Type: text/plain Date: Thu, 10 Jan 2008 14:13:07 +0100 Message-Id: <1199970787.2017.1.camel@ws1.local.fransdb.nl> Mime-Version: 1.0 X-Mailer: Evolution 2.12.0 Content-Transfer-Encoding: 7bit X-detected-kernel: by monty-python.gnu.org: Genre and OS details not recognized. Subject: Comparison failure X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Jan 2008 13:13:19 -0000 To: bug-bash@gnu.org Subject: Comparison failure Configuration Information [Automatically generated, do not change]: Machine: x86_64 OS: linux-gnu Compiler: gcc Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='x86_64' -DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='x86_64-unknown-linux-gnu' -DCONF_VENDOR='unknown' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash' -DSHELL -DHAVE_CONFIG_H -I. -I. -I./include -I./lib -g -O2 uname output: Linux ws1 2.6.22.13-0.3-default #1 SMP 2007/11/19 15:02:58 UTC x86 _64 x86_64 x86_64 GNU/Linux Machine Type: x86_64-unknown-linux-gnu Bash Version: 3.2 Patch Level: 33 Release Status: release Description: 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. Sometimes it went wrong when the number was three (2) in this example it is 6. This has worked before with another version of bash. The version output for bash is: GNU bash, version 3.2.25(1)-release (x86_64-suse-linux-gnu) from the SuSE10.3 distribution. A personaly compiled bash GNU bash, version 3.2.33(1)-release (x86_64-unknown-linux-gnu). Both behave the same. ------ Used function -> # function rec_next () { local -ir i=$1 if [[ $i != -1 && $i < $((iPriTblCnt-1)) ]]; then echo $((i+1)); else echo -1 fi } # ------ Example trace 1 -> + i=5 + (( 5 != -1 )) + printf 'PhysRec=5 Date=20071101 File=Archive-Chm-0.05.tar.gz CS= AP=0 \n' PhysRec=5 Date=20071101 File=Archive-Chm-0.05.tar.gz CS= AP=0 ++ rec_next 5 ++ local -ir i=5 ++ [[ 5 != -1 ]] ++ [[ 5 < 54 ]] ++ echo 6 + i=6 + (( 6 != -1 )) + printf 'PhysRec=6 Date=20071101 File=Archive-Cpio-0.02.tar.gz CS= AP=0 \n' PhysRec=6 Date=20071101 File=Archive-Cpio-0.02.tar.gz CS= AP=0 ++ rec_next 6 ++ local -ir i=6 ++ [[ 6 != -1 ]] ++ [[ 6 < 54 ]] ++ echo -1 + i=-1 ------------- Example trace 2 -> + i=1 + (( 1 != -1 )) + printf 'PhysRec=1 Date=20071101 File=Archive-Any-0.091.tar.gz CS= AP=0 \n' PhysRec=1 Date=20071101 File=Archive-Any-0.091.tar.gz CS= AP=0 ++ rec_next 1 ++ local -i i=1 ++ [[ 1 != -1 ]] ++ [[ 1 < 109 ]] ++ echo 2 + i=2 + (( 2 != -1 )) + printf 'PhysRec=2 Date=20071101 File=Archive-Any-0.092.tar.gz CS= AP=0 \n' PhysRec=2 Date=20071101 File=Archive-Any-0.092.tar.gz CS= AP=0 ++ rec_next 2 ++ local -i i=2 ++ [[ 2 != -1 ]] ++ [[ 2 < 109 ]] ++ echo -1 + i=-1 + (( -1 != -1 )) I use a variable to set the level of debugging --debug=|--debug|-d) declare -i fDEBUG=1 declare -i fVerbose=1 unset fQuiet if [[ $3 == [1-9] ]]; then fDEBUG=$3 shift 1 fi ;; If the fDEBUG variable is set to 3, less or not declared at all, example two applies, otherwise example 1 applies. It has worked with previous version of bash, so I suspect that it's a bash error. Can you help? Kind regards Frans de Boer. From MAILER-DAEMON Thu Jan 10 09:37:04 2008 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1JCyWm-00033f-Im for mharc-bug-bash@gnu.org; Thu, 10 Jan 2008 09:37:04 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JCyWl-00031I-F9 for bug-bash@gnu.org; Thu, 10 Jan 2008 09:37:03 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JCyWj-0002xj-QR for bug-bash@gnu.org; Thu, 10 Jan 2008 09:37:02 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JCyWj-0002xX-IH for bug-bash@gnu.org; Thu, 10 Jan 2008 09:37:01 -0500 Received: from mu-out-0910.google.com ([209.85.134.187]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JCyWj-0002Wg-3H for bug-bash@gnu.org; Thu, 10 Jan 2008 09:37:01 -0500 Received: by mu-out-0910.google.com with SMTP id g7so347069muf.0 for ; Thu, 10 Jan 2008 06:36:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:sender:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references:x-google-sender-auth; bh=J8XS0KA76NplEBp+7XHZ84h3u28XktAO39TuWdzDT2g=; b=XTZGK2q9gIjvpfic/h3pzzsGW1lT0VG2APEjcW9Mas/GLmPT+RMEqqAOFcjojzPoKt0pvBn49i1orXZM/qh+U4pt/mxs5PEm7mtvcZT1uzVoTebVNml8yTVZD6XTdLlDf0Dh9BavxsiHpKuu/bfWZaLa/Yqpi0XgymL1wMdd/WY= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:sender:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references:x-google-sender-auth; b=N050uIiimX5HlbRUKRBgeOT13BZfElYJZVpzBa0g9ePXrtyjIYFB+e//c4d9vws1ctXP7c4xuiwWbMNahMMEiFZkm6zp3Si3GWWah243AYnxDD7IWMcA/ATfPJwSfeb8NKflriGj2NAamw/LUNXWFHTznv6B9A9jtp9a4TA01fg= Received: by 10.78.150.7 with SMTP id x7mr2271379hud.48.1199975819145; Thu, 10 Jan 2008 06:36:59 -0800 (PST) Received: by 10.78.190.15 with HTTP; Thu, 10 Jan 2008 06:36:54 -0800 (PST) Message-ID: <5fb589920801100636n7e3c27acsbd17147841ebb957@mail.gmail.com> Date: Thu, 10 Jan 2008 09:36:54 -0500 From: "Dave Rutherford" Sender: dave.rutherford@gmail.com To: "Frans de Boer" , bug-bash@gnu.org In-Reply-To: <1199970787.2017.1.camel@ws1.local.fransdb.nl> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <1199970787.2017.1.camel@ws1.local.fransdb.nl> X-Google-Sender-Auth: d06d8b731a5306ce X-detected-kernel: by monty-python.gnu.org: Linux 2.6 (newer, 2) Cc: Subject: Re: Comparison failure X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Jan 2008 14:37:03 -0000 On Jan 10, 2008 8:13 AM, Frans de Boer wrote: > Following is a function which fails constantly. [...] > if [[ $i != -1 && $i < $((iPriTblCnt-1)) ]]; then > echo $((i+1)); > else > echo -1 > fi Now, "[[" isn't very well documented, so I tend not to use it, but notice how "<" behaves here. It looks like it's doing a string comparison. Try "-lt" to get a numeric less-than. > ------ Example trace 1 -> [...] > ++ [[ 5 < 54 ]] > ++ echo 6 [...] > ++ [[ 6 < 54 ]] > ++ echo -1 [...] > ------------- Example trace 2 -> [...] > ++ [[ 1 < 109 ]] > ++ echo 2 [...] > ++ [[ 2 < 109 ]] > ++ echo -1 Regards, Dave From MAILER-DAEMON Thu Jan 10 10:34:23 2008 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1JCzQF-0007rJ-BX for mharc-bug-bash@gnu.org; Thu, 10 Jan 2008 10:34:23 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JCzQD-0007na-1y for bug-bash@gnu.org; Thu, 10 Jan 2008 10:34:21 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JCzQB-0007lV-CL for bug-bash@gnu.org; Thu, 10 Jan 2008 10:34:20 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JCzQB-0007lJ-8Y for bug-bash@gnu.org; Thu, 10 Jan 2008 10:34:19 -0500 Received: from smtp-out1.tiscali.nl ([195.241.79.176]) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1JCzQB-0000PI-1O for bug-bash@gnu.org; Thu, 10 Jan 2008 10:34:19 -0500 Received: from [195.241.250.239] (helo=pubserv1.fransdb.nl) by smtp-out1.tiscali.nl with esmtp (Tiscali http://www.tiscali.nl) id 1JCzQ5-00067o-UR; Thu, 10 Jan 2008 16:34:15 +0100 Received: from localhost (localhost [127.0.0.1]) by pubserv1.fransdb.nl (Postfix) with ESMTP id 0500316EF6; Thu, 10 Jan 2008 13:52:54 +0100 (CET) X-Virus-Scanned: amavisd-new at fransdb.nl Received: from pubserv1.fransdb.nl ([127.0.0.1]) by localhost (pubserv1.fransdb.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id Y1LfQzT40hpG; Thu, 10 Jan 2008 13:52:51 +0100 (CET) Received: from [192.168.49.26] (unknown [192.168.49.2]) by pubserv1.fransdb.nl (Postfix) with ESMTP id 2A98316EF5; Thu, 10 Jan 2008 13:52:51 +0100 (CET) From: Frans de Boer To: Pierre Gaston , ";" In-Reply-To: References: <1199970787.2017.1.camel@ws1.local.fransdb.nl> Content-Type: text/plain Date: Thu, 10 Jan 2008 16:34:08 +0100 Message-Id: <1199979248.2017.10.camel@ws1.local.fransdb.nl> Mime-Version: 1.0 X-Mailer: Evolution 2.12.0 Content-Transfer-Encoding: 7bit X-detected-kernel: by monty-python.gnu.org: Genre and OS details not recognized. Cc: bug-bash@gnu.org Subject: Re: Comparison failure X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Jan 2008 15:34:21 -0000 You where both right. It's the '<' versus -lt. I tend to avoid -lt because I always run into errors using this. Beside, in previous versions of Bash it did not give me this problem. But, i will give it a try in other functions to see if it works now everywhere as expected. And yes, the use of these comparison tokens is not well documented either. I have always read the documentation that they where interchangeable, which is clearly not the case. Thanks, subject can be closed. Frans de Boer. On Thu, 2008-01-10 at 16:17 +0200, Pierre Gaston wrote: > On Jan 10, 2008 3:13 PM, Frans de Boer 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. Sometimes it went wrong when the number was > > three (2) in this example it is 6. This has worked before with another > > version of bash. > > ++ [[ 5 < 54 ]] > > > > < = != > inside [[ ]] compares strings not numbers ie [[ 2 < 103 ]] is false > > use either [[ 2 -lt 103 ]] or the arithmetic evaluation : (( 2 < 103 )) From MAILER-DAEMON Thu Jan 10 11:20:46 2008 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1JD098-0004jo-17 for mharc-bug-bash@gnu.org; Thu, 10 Jan 2008 11:20:46 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JD096-0004jP-0H for bug-bash@gnu.org; Thu, 10 Jan 2008 11:20:44 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JD095-0004j9-C2 for bug-bash@gnu.org; Thu, 10 Jan 2008 11:20:43 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JD095-0004j2-4g for bug-bash@gnu.org; Thu, 10 Jan 2008 11:20:43 -0500 Received: from m1.goneo.de ([82.100.220.80]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JD095-0005wJ-3d for bug-bash@gnu.org; Thu, 10 Jan 2008 11:20:43 -0500 Received: from localhost (localhost.goneo.de [127.0.0.1]) by scan.goneo.de (Postfix) with ESMTP id BCECA64FF2E for ; Thu, 10 Jan 2008 17:20:40 +0100 (CET) Received: from m1.goneo.de ([127.0.0.1]) by localhost (m1.goneo.de [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 61881-01 for ; Thu, 10 Jan 2008 17:19:58 +0100 (CET) Received: from [192.168.178.2] (c174059.adsl.hansenet.de [213.39.174.59]) by m1-smtp.goneo.de (Postfix) with ESMTP id 4530864FD14 for ; Thu, 10 Jan 2008 17:19:58 +0100 (CET) Message-ID: <478645AD.1010603@sudrala.de> Date: Thu, 10 Jan 2008 17:19:57 +0100 From: Bernd Eggink User-Agent: Thunderbird 2.0.0.9 (X11/20071031) MIME-Version: 1.0 To: bug-bash@gnu.org References: <1199970787.2017.1.camel@ws1.local.fransdb.nl> <1199979248.2017.10.camel@ws1.local.fransdb.nl> In-Reply-To: <1199979248.2017.10.camel@ws1.local.fransdb.nl> Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: amavisd-new at goneo.de X-Spam-Score: -0.288 X-detected-kernel: by monty-python.gnu.org: FreeBSD 6.x (1) Subject: Re: Comparison failure X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Jan 2008 16:20:44 -0000 Frans de Boer schrieb: > You where both right. It's the '<' versus -lt. I tend to avoid -lt > because I always run into errors using this. Beside, in previous > versions of Bash it did not give me this problem. But, i will give it a > try in other functions to see if it works now everywhere as expected. > And yes, the use of these comparison tokens is not well documented > either. I have always read the documentation that they where > interchangeable, which is clearly not the case. Hm, 'man bash' clearly states in section "Conditional expressions" (that's what is included in [[ ... ]]): string1 < string2 True if string1 sorts before string2 lexicographically in the current locale. arg1 OP arg2 OP is one of -eq, -ne, -lt, -le, -gt, or -ge. These arithmetic binary operators return true if arg1 is equal to, not equal to, less than, less than or equal to, greater than, or greater than or equal to arg2, respectively. Arg1 and arg2 may be positive or negative integers. Personally, I like the bash documentation because it is complete and concise. Greetings, Bernd -- Bernd Eggink monoped@sudrala.de http://sudrala.de From MAILER-DAEMON Thu Jan 10 12:32:24 2008 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1JD1GS-0006jR-0N for mharc-bug-bash@gnu.org; Thu, 10 Jan 2008 12:32:24 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JD1GP-0006ei-4Q for bug-bash@gnu.org; Thu, 10 Jan 2008 12:32:21 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JD1GL-0006YK-1i for bug-bash@gnu.org; Thu, 10 Jan 2008 12:32:19 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JD1GK-0006Xy-Ma for bug-bash@gnu.org; Thu, 10 Jan 2008 12:32:16 -0500 Received: from ns.suse.de ([195.135.220.2] helo=mx1.suse.de) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1JD1GK-0005hV-J2 for bug-bash@gnu.org; Thu, 10 Jan 2008 12:32:16 -0500 Received: from Relay1.suse.de (mail2.suse.de [195.135.221.8]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.suse.de (Postfix) with ESMTP id E3092263C7; Thu, 10 Jan 2008 18:32:11 +0100 (CET) From: Andreas Schwab To: Frans de Boer References: <1199970787.2017.1.camel@ws1.local.fransdb.nl> <1199979248.2017.10.camel@ws1.local.fransdb.nl> X-Yow: Yow! Maybe I should have asked for my Neutron Bomb in PAISLEY-- Date: Thu, 10 Jan 2008 18:32:11 +0100 In-Reply-To: <1199979248.2017.10.camel@ws1.local.fransdb.nl> (Frans de Boer's message of "Thu\, 10 Jan 2008 16\:34\:08 +0100") Message-ID: User-Agent: Gnus/5.110006 (No Gnus v0.6) Emacs/22.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable X-detected-kernel: by monty-python.gnu.org: Linux 2.4-2.6 Cc: bug-bash@gnu.org, Pierre Gaston Subject: Re: Comparison failure X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Jan 2008 17:32:22 -0000 Frans de Boer writes: > You where both right. It's the '<' versus -lt. I tend to avoid -lt > because I always run into errors using this. Beside, in previous > versions of Bash it did not give me this problem. AFAICS all versions of bash that implement [[ ]] have always behaved that way, which is consistent with ksh. Andreas. --=20 Andreas Schwab, SuSE Labs, schwab@suse.de SuSE Linux Products GmbH, Maxfeldstra=DFe 5, 90409 N=FCrnberg, Germany PGP key fingerprint =3D 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED= 5 "And now for something completely different." From MAILER-DAEMON Thu Jan 10 13:34:46 2008 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1JD2Eo-0001v1-Gu for mharc-bug-bash@gnu.org; Thu, 10 Jan 2008 13:34:46 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JD2Em-0001uw-Sm for bug-bash@gnu.org; Thu, 10 Jan 2008 13:34:44 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JD2Ek-0001u2-Ez for bug-bash@gnu.org; Thu, 10 Jan 2008 13:34:43 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JD2Ek-0001tz-9b for bug-bash@gnu.org; Thu, 10 Jan 2008 13:34:42 -0500 Received: from ik-out-1112.google.com ([66.249.90.176]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JD2Ek-0001V4-BJ for bug-bash@gnu.org; Thu, 10 Jan 2008 13:34:42 -0500 Received: by ik-out-1112.google.com with SMTP id c29so167253ika.2 for ; Thu, 10 Jan 2008 10:34:40 -0800 (PST) Received: by 10.150.145.20 with SMTP id s20mr809778ybd.5.1199974657092; Thu, 10 Jan 2008 06:17:37 -0800 (PST) Received: by 10.150.146.15 with HTTP; Thu, 10 Jan 2008 06:17:37 -0800 (PST) Message-ID: Date: Thu, 10 Jan 2008 16:17:37 +0200 From: "Pierre Gaston" To: "Frans de Boer" In-Reply-To: <1199970787.2017.1.camel@ws1.local.fransdb.nl> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <1199970787.2017.1.camel@ws1.local.fransdb.nl> X-detected-kernel: by monty-python.gnu.org: Linux 2.6 (newer, 2) Cc: bug-bash@gnu.org Subject: Re: Comparison failure X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Jan 2008 18:34:45 -0000 On Jan 10, 2008 3:13 PM, Frans de Boer 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. Sometimes it went wrong when the number was > three (2) in this example it is 6. This has worked before with another > version of bash. > ++ [[ 5 < 54 ]] > < = != > inside [[ ]] compares strings not numbers ie [[ 2 < 103 ]] is false use either [[ 2 -lt 103 ]] or the arithmetic evaluation : (( 2 < 103 )) From MAILER-DAEMON Thu Jan 10 14:00:03 2008 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1JD2dH-0000nO-1g for mharc-bug-bash@gnu.org; Thu, 10 Jan 2008 14:00:03 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JD2dF-0000l4-0U for bug-bash@gnu.org; Thu, 10 Jan 2008 14:00:01 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JD2dA-0000eE-6S for bug-bash@gnu.org; Thu, 10 Jan 2008 14:00:00 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JD2d9-0000dx-Rz for bug-bash@gnu.org; Thu, 10 Jan 2008 13:59:55 -0500 Received: from mpv2.tis.cwru.edu ([129.22.105.37]) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_3DES_EDE_CBC_SHA1:24) (Exim 4.60) (envelope-from ) id 1JD2d9-0007C8-VG for bug-bash@gnu.org; Thu, 10 Jan 2008 13:59:56 -0500 Received: from mpv5.TIS.cwru.edu (mpv5.TIS.CWRU.Edu [129.22.105.51]) by mpv2.tis.cwru.edu (MOS 3.8.6-GA) with ESMTP id CPW28273; Thu, 10 Jan 2008 13:59:49 -0500 (EST) Received: from caleb.ins.cwru.edu (caleb.INS.CWRU.Edu [129.22.8.211]) by mpv5.TIS.cwru.edu (MOS 3.8.6-GA) with ESMTP id DQD95751 (AUTH cpr); Thu, 10 Jan 2008 13:59:47 -0500 (EST) Message-ID: <47866B22.6080507@case.edu> Date: Thu, 10 Jan 2008 13:59:46 -0500 From: Chet Ramey Organization: ITS, Case Western Reserve University User-Agent: Thunderbird 2.0.0.9 (Macintosh/20071031) MIME-Version: 1.0 To: Dave Rutherford References: <1199970787.2017.1.camel@ws1.local.fransdb.nl> <5fb589920801100636n7e3c27acsbd17147841ebb957@mail.gmail.com> In-Reply-To: <5fb589920801100636n7e3c27acsbd17147841ebb957@mail.gmail.com> X-Enigmail-Version: 0.95.6 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Junkmail-Status: score=10/49, host=mpv2.tis.cwru.edu X-Junkmail-SD-Raw: score=unknown, refid=str=0001.0A090204.47866B25.00DF,ss=1,fgs=0, ip=129.22.105.51, so=2007-10-30 19:00:17, dmn=5.4.3/2007-11-16 X-Junkmail-IWF: false X-detected-kernel: by monty-python.gnu.org: Genre and OS details not recognized. Cc: Frans de Boer , bug-bash@gnu.org, chet@case.edu Subject: Re: Comparison failure X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: chet.ramey@case.edu List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Jan 2008 19:00:01 -0000 Dave Rutherford wrote: > Now, "[[" isn't very well documented, so I tend not to use it, I'm always interested in suggestions for improving the bash documentation. Can you tell me what's unclear about the existing description of `[['? Chet -- ``The lyf so short, the craft so long to lerne.'' - Chaucer Live Strong. No day but today. Chet Ramey, ITS, CWRU chet@case.edu http://cnswww.cns.cwru.edu/~chet/ From MAILER-DAEMON Thu Jan 10 14:25:36 2008 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1JD320-0007jy-9v for mharc-bug-bash@gnu.org; Thu, 10 Jan 2008 14:25:36 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JD31y-0007hP-AN for bug-bash@gnu.org; Thu, 10 Jan 2008 14:25:34 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JD31w-0007f0-DC for Bug-bash@gnu.org; Thu, 10 Jan 2008 14:25:33 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JD31w-0007eJ-5J for Bug-bash@gnu.org; Thu, 10 Jan 2008 14:25:32 -0500 Received: from kuber.nabble.com ([216.139.236.158]) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1JD31v-00049U-Uw for Bug-bash@gnu.org; Thu, 10 Jan 2008 14:25:32 -0500 Received: from isper.nabble.com ([192.168.236.156]) by kuber.nabble.com with esmtp (Exim 4.63) (envelope-from ) id 1JD31u-0001aU-Hc for Bug-bash@gnu.org; Thu, 10 Jan 2008 11:25:30 -0800 Message-ID: <14740823.post@talk.nabble.com> Date: Thu, 10 Jan 2008 11:25:30 -0800 (PST) From: Kelsey Hightower To: Bug-bash@gnu.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Nabble-From: kelsey@kelseyhightower.net X-detected-kernel: by monty-python.gnu.org: Linux 2.6 (newer, 3) Cc: Subject: Bash version 4 X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Jan 2008 19:25:34 -0000 I have a general question. What is expected for Bash version 4 (features, release date, etc) ? Is there any where I can follow its development? Thanks -- View this message in context: http://www.nabble.com/Bash-version-4-tp14740823p14740823.html Sent from the Gnu - Bash mailing list archive at Nabble.com. From MAILER-DAEMON Thu Jan 10 15:32:39 2008 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1JD44t-0006SU-0c for mharc-bug-bash@gnu.org; Thu, 10 Jan 2008 15:32:39 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JD44q-0006Nu-Js for bug-bash@gnu.org; Thu, 10 Jan 2008 15:32:36 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JD44o-0006Kp-HX for bug-bash@gnu.org; Thu, 10 Jan 2008 15:32:35 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JD44o-0006Kb-8J for bug-bash@gnu.org; Thu, 10 Jan 2008 15:32:34 -0500 Received: from fk-out-0910.google.com ([209.85.128.187]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JD44o-0002TC-Jb for bug-bash@gnu.org; Thu, 10 Jan 2008 15:32:34 -0500 Received: by fk-out-0910.google.com with SMTP id 26so668311fkx.10 for ; Thu, 10 Jan 2008 12:32:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:sender:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references:x-google-sender-auth; bh=st9/Rccs2cj+WwIqew2avgALJOpRZGcGO6W33KCIZQs=; b=ulNeuszpudgncpLrf81JMVkI9AFre4LDottsQSh8XmKPMBzndy/5VH/mnk0YSYRcMYzXB48pMMH0szxR3VPbyhO6EsGmXT8HohTdYtN9mwgBgFS5Ga4EanPebT8zuP9Cmvo3KWQehZOOpFRFI5FCS1XJ8hTt8sdbaf5xZtK0z34= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:sender:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references:x-google-sender-auth; b=g5jYu6C8GCB5yrtz3Lz0dYSPwd3ZUAJT4rx9Nnjkyjd6FC6YP78DNpEvTZRoGt5+VX6iRlegJBPGH+nsAgH0L7ZiRgS2h4ZALYthHFTntyUeFgnV6KoRoTyYd7Oq3tbRdbK4A2ZFsaHLEExBIwntco6H3FXTdSUvxEngZOrz1xY= Received: by 10.78.138.6 with SMTP id l6mr443068hud.32.1199997152372; Thu, 10 Jan 2008 12:32:32 -0800 (PST) Received: by 10.78.190.15 with HTTP; Thu, 10 Jan 2008 12:32:32 -0800 (PST) Message-ID: <5fb589920801101232m250e35f9t9e13834d1daa5fbd@mail.gmail.com> Date: Thu, 10 Jan 2008 15:32:32 -0500 From: "Dave Rutherford" Sender: dave.rutherford@gmail.com To: chet.ramey@case.edu In-Reply-To: <47866B22.6080507@case.edu> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <1199970787.2017.1.camel@ws1.local.fransdb.nl> <5fb589920801100636n7e3c27acsbd17147841ebb957@mail.gmail.com> <47866B22.6080507@case.edu> X-Google-Sender-Auth: 4421572d48cd1c21 X-detected-kernel: by monty-python.gnu.org: Linux 2.6 (newer, 2) Cc: Frans de Boer , bug-bash@gnu.org, chet@case.edu Subject: Re: Comparison failure X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Jan 2008 20:32:36 -0000 Chet Ramey wrote: > Dave Rutherford wrote: > > Now, "[[" isn't very well documented, so I tend not to use it, > > I'm always interested in suggestions for improving the bash documentation. > Can you tell me what's unclear about the existing description of > `[['? It's probably my fault. I just don't really understand why it exists. I know it does one thing -- =~ -- that `test' doesn't. I've never needed that. The string operators ${#, %, /} are my friends. So are awk and sed. And bash in general, for that matter. But if I need a regex, it's probably to do some modification, so I'll need to do more with it than merely match it. If `test' weren't a shell builtin but was still /bin/[, I'd be using [[ for speed. But it is, so I don't. I know test's quirks. Does [[ have quirks? Are they the same? Is there room in my grey matter to hold both sets of quirks and keep them straight? Perhaps a FAQ entry, or a part of the man page, explaining when to use [[ and when [ would be of some help. Best regards, Dave From MAILER-DAEMON Thu Jan 10 19:15:11 2008 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1JD7YF-0006YJ-Pb for mharc-bug-bash@gnu.org; Thu, 10 Jan 2008 19:15:11 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JD2Ml-0007zc-Uy for bug-bash@gnu.org; Thu, 10 Jan 2008 13:42:59 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JD2Mk-0007yi-1Y for Bug-bash@gnu.org; Thu, 10 Jan 2008 13:42:59 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JD2Mj-0007yf-RM for Bug-bash@gnu.org; Thu, 10 Jan 2008 13:42:57 -0500 Received: from kuber.nabble.com ([216.139.236.158]) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1JD2Mj-0003aO-Ub for Bug-bash@gnu.org; Thu, 10 Jan 2008 13:42:58 -0500 Received: from isper.nabble.com ([192.168.236.156]) by kuber.nabble.com with esmtp (Exim 4.63) (envelope-from ) id 1JD2Mi-0008Ru-7D for Bug-bash@gnu.org; Thu, 10 Jan 2008 10:42:56 -0800 Message-ID: <14740823.post@talk.nabble.com> Date: Thu, 10 Jan 2008 10:42:56 -0800 (PST) From: khightower To: Bug-bash@gnu.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Nabble-From: kelsey@kelseyhightower.net X-detected-kernel: by monty-python.gnu.org: Linux 2.6 (newer, 3) X-Mailman-Approved-At: Thu, 10 Jan 2008 19:15:10 -0500 Cc: Subject: Bash version 4 X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Jan 2008 18:43:00 -0000 I have a general question. What is expected for Bash version 4 (features, release date, etc) ? Is there any where I can follow its development? Thanks -- View this message in context: http://www.nabble.com/Bash-version-4-tp14740823p14740823.html Sent from the Gnu - Bash mailing list archive at Nabble.com. From MAILER-DAEMON Fri Jan 11 10:34:34 2008 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1JDLty-0007cE-1i for mharc-bug-bash@gnu.org; Fri, 11 Jan 2008 10:34:34 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JDAoO-0003Gh-2T for bug-bash@gnu.org; Thu, 10 Jan 2008 22:44:04 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JDAoJ-0003Ev-1f for bug-bash@gnu.org; Thu, 10 Jan 2008 22:44:03 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JDAoI-0003Er-LE for bug-bash@gnu.org; Thu, 10 Jan 2008 22:43:58 -0500 Received: from mercav06.na.sas.com ([149.173.6.153]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JDAoI-0004RY-Ap for bug-bash@gnu.org; Thu, 10 Jan 2008 22:43:58 -0500 Received: from [10.40.13.87] ([10.40.13.87]) by mercav06.na.sas.com with InterScan Message Security Suite; Thu, 10 Jan 2008 22:13:56 -0500 Message-ID: <4786DEEF.30409@sas.com> Date: Thu, 10 Jan 2008 22:13:51 -0500 From: Dmitry V Golovashkin Organization: Advanced Computing Lab, SAS Institute Inc. User-Agent: Thunderbird 2.0.0.6 (X11/20071022) Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1; format=flowed Content-Transfer-Encoding: 7bit To: bug-bash@gnu.org X-detected-kernel: by monty-python.gnu.org: Windows 2000 SP4, XP SP1+ X-Greylist: delayed 1800 seconds by postgrey-1.27 at monty-python; Thu, 10 Jan 2008 22:43:57 EST X-Mailman-Approved-At: Fri, 11 Jan 2008 10:34:32 -0500 Subject: Bash string substitution bug (?) X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Jan 2008 03:44:04 -0000 Configuration Information [Automatically generated, do not change]: Machine: x86_64 OS: linux-gnu Compiler: x86_64-redhat-linux-gcc Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='x86_64' -DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='x86_64-redhat-linux-gnu' -DCONF_VENDOR='redhat' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash' -DSHELL -DHAVE_CONFIG_H -I. -I. -I./include -I./lib -O2 -g -pipe -m64 uname output: Linux acl201.unx.sas.com 2.6.9-42.ELsmp #1 SMP Wed Jul 12 23:32:02 EDT 2006 x86_64 x86_64 x86_64 GNU/Linux Machine Type: x86_64-redhat-linux-gnu Bash Version: 3.0 Patch Level: 15 Release Status: release Description: unexpected bad substitution: enter the following simple list: prompt: CLUSTER='1 2'; echo ${CLUSTER/${HOSTNAME%%.*}} output: 1 2 the idea of the above line is to remove short HOSTNAME (without the trailing domain) from the CLUSTER - works fine (CLUSTER was assigned a dummy value - irrelevant) however the same operation with slash results in a bad substitution error. the substitution appears to be a valid one. prompt: CLUSTER='1 2'; echo ${CLUSTER/${HOSTNAME/.*}} output: -bash: ${HOSTNAME: bad substitution Repeat-By: Fix: From MAILER-DAEMON Fri Jan 11 11:29:17 2008 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1JDMkv-0000bx-8f for mharc-bug-bash@gnu.org; Fri, 11 Jan 2008 11:29:17 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JDMkt-0000Zu-ME for bug-bash@gnu.org; Fri, 11 Jan 2008 11:29:15 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JDMkr-0000Vv-EC for bug-bash@gnu.org; Fri, 11 Jan 2008 11:29:15 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JDMkq-0000Vb-Qw for bug-bash@gnu.org; Fri, 11 Jan 2008 11:29:12 -0500 Received: from m1.goneo.de ([82.100.220.80]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JDMkq-0003aq-44 for bug-bash@gnu.org; Fri, 11 Jan 2008 11:29:12 -0500 Received: from localhost (localhost.goneo.de [127.0.0.1]) by scan.goneo.de (Postfix) with ESMTP id 031FC650036; Fri, 11 Jan 2008 17:29:00 +0100 (CET) Received: from m1.goneo.de ([127.0.0.1]) by localhost (m1.goneo.de [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 46210-01-18; Fri, 11 Jan 2008 17:28:42 +0100 (CET) Received: from [192.168.178.2] (d083001.adsl.hansenet.de [80.171.83.1]) by m1-smtp.goneo.de (Postfix) with ESMTP id AC0BF64FD54; Fri, 11 Jan 2008 17:28:41 +0100 (CET) Message-ID: <47879939.4070403@sudrala.de> Date: Fri, 11 Jan 2008 17:28:41 +0100 From: Bernd Eggink User-Agent: Thunderbird 2.0.0.9 (X11/20071031) MIME-Version: 1.0 To: bug-bash@gnu.org References: <4786DEEF.30409@sas.com> In-Reply-To: <4786DEEF.30409@sas.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: amavisd-new at goneo.de X-Spam-Score: -0.166 X-detected-kernel: by monty-python.gnu.org: FreeBSD 6.x (1) Cc: Dmitry V Golovashkin Subject: Re: Bash string substitution bug (?) X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Jan 2008 16:29:16 -0000 Dmitry V Golovashkin schrieb: > Description: > unexpected bad substitution: > enter the following simple list: > > prompt: CLUSTER='1 2'; echo ${CLUSTER/${HOSTNAME%%.*}} > output: 1 2 > > the idea of the above line is to remove short HOSTNAME (without the > trailing domain) > from the CLUSTER - works fine (CLUSTER was assigned a dummy > value - irrelevant) > however the same operation with slash results in a bad substitution > error. > the substitution appears to be a valid one. > > prompt: CLUSTER='1 2'; echo ${CLUSTER/${HOSTNAME/.*}} > output: -bash: ${HOSTNAME: bad substitution Apparently bash interprets this as ${parameter/pattern/string} where pattern = ${HOSTNAME. Looks like a bug; it works in ksh. As a workaround, you could use: H=${HOSTNAME/.*} echo ${CLUSTER/$H} Regards, Bernd -- Bernd Eggink monoped@sudrala.de http://sudrala.de From MAILER-DAEMON Fri Jan 11 13:44:41 2008 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1JDOrx-0007UW-Qf for mharc-bug-bash@gnu.org; Fri, 11 Jan 2008 13:44:41 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JDOrw-0007SL-NT for bug-bash@gnu.org; Fri, 11 Jan 2008 13:44:40 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JDOrv-0007Pa-4c for bug-bash@gnu.org; Fri, 11 Jan 2008 13:44:40 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JDOrv-0007PS-1L for bug-bash@gnu.org; Fri, 11 Jan 2008 13:44:39 -0500 Received: from mpv4.tis.cwru.edu ([129.22.105.34]) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_3DES_EDE_CBC_SHA1:24) (Exim 4.60) (envelope-from ) id 1JDOru-00037r-U4 for bug-bash@gnu.org; Fri, 11 Jan 2008 13:44:39 -0500 Received: from mpv5.TIS.cwru.edu (mpv5.TIS.CWRU.Edu [129.22.105.51]) by mpv4.tis.cwru.edu (MOS 3.8.6-GA) with ESMTP id CGP64819; Fri, 11 Jan 2008 13:44:33 -0500 (EST) Received: from z4.local (h17.254.40.69.ip.alltel.net [69.40.254.17]) by mpv5.TIS.cwru.edu (MOS 3.8.6-GA) with ESMTP id DQJ03490 (AUTH cpr); Fri, 11 Jan 2008 13:44:31 -0500 (EST) Message-ID: <4787B909.7090808@case.edu> Date: Fri, 11 Jan 2008 13:44:25 -0500 From: Chet Ramey Organization: ITS, Case Western Reserve University User-Agent: Thunderbird 2.0.0.9 (Macintosh/20071031) MIME-Version: 1.0 To: Bernd Eggink References: <4786DEEF.30409@sas.com> <47879939.4070403@sudrala.de> In-Reply-To: <47879939.4070403@sudrala.de> X-Enigmail-Version: 0.95.6 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Junkmail-Status: score=10/49, host=mpv4.tis.cwru.edu X-Junkmail-SD-Raw: score=unknown, refid=str=0001.0A090209.4787B914.01EF,ss=1,fgs=0, ip=69.40.254.17, so=2007-10-30 19:00:17, dmn=5.4.3/2007-11-16 X-Junkmail-IWF: false X-detected-kernel: by monty-python.gnu.org: Genre and OS details not recognized. Cc: Dmitry V Golovashkin , bug-bash@gnu.org, chet@case.edu Subject: Re: Bash string substitution bug (?) X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: chet.ramey@case.edu List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Jan 2008 18:44:40 -0000 Bernd Eggink wrote: >> >> prompt: CLUSTER='1 2'; echo ${CLUSTER/${HOSTNAME/.*}} >> output: -bash: ${HOSTNAME: bad substitution > > Apparently bash interprets this as ${parameter/pattern/string} > where pattern = ${HOSTNAME. Looks like a bug; it works in ksh. That is, in fact, what is happening. I'm not sure you can call it a bug, though -- bash is behaving exactly as documented. The fact that Korn chose to implement it a certain way in ksh and not document the implementation doesn't help compatibility, but the public specification of the feature is the same between both shells. Chet -- ``The lyf so short, the craft so long to lerne.'' - Chaucer Live Strong. No day but today. Chet Ramey, ITS, CWRU chet@case.edu http://cnswww.cns.cwru.edu/~chet/ From MAILER-DAEMON Fri Jan 11 15:30:34 2008 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1JDQWQ-0008Dk-Lv for mharc-bug-bash@gnu.org; Fri, 11 Jan 2008 15:30:34 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JDQWP-0008Cj-7G for bug-bash@gnu.org; Fri, 11 Jan 2008 15:30:33 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JDQWM-0008BY-Dm for bug-bash@gnu.org; Fri, 11 Jan 2008 15:30:32 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JDQWM-0008BT-9Q for bug-bash@gnu.org; Fri, 11 Jan 2008 15:30:30 -0500 Received: from m2.goneo.de ([82.100.220.83]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JDQWM-0002OL-0Y for bug-bash@gnu.org; Fri, 11 Jan 2008 15:30:30 -0500 Received: from localhost (localhost.goneo.de [127.0.0.1]) by scan.goneo.de (Postfix) with ESMTP id 4863C130D8D; Fri, 11 Jan 2008 21:30:24 +0100 (CET) Received: from m2.goneo.de ([127.0.0.1]) by localhost (m2.goneo.de [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 19004-01-11; Fri, 11 Jan 2008 21:30:07 +0100 (CET) Received: from [192.168.178.2] (d083001.adsl.hansenet.de [80.171.83.1]) by m2-smtp.goneo.de (Postfix) with ESMTP id AE711130E08; Fri, 11 Jan 2008 21:30:06 +0100 (CET) Message-ID: <4787D1CE.8040602@sudrala.de> Date: Fri, 11 Jan 2008 21:30:06 +0100 From: Bernd Eggink User-Agent: Thunderbird 2.0.0.9 (X11/20071031) MIME-Version: 1.0 To: chet.ramey@case.edu References: <4786DEEF.30409@sas.com> <47879939.4070403@sudrala.de> <4787B909.7090808@case.edu> In-Reply-To: <4787B909.7090808@case.edu> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: amavisd-new at goneo.de X-Spam-Score: -0.224 X-detected-kernel: by monty-python.gnu.org: FreeBSD 6.x (1) Cc: Dmitry V Golovashkin , bug-bash@gnu.org Subject: Re: Bash string substitution bug (?) X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Jan 2008 20:30:33 -0000 Chet Ramey schrieb: > Bernd Eggink wrote: >>> >>> prompt: CLUSTER='1 2'; echo ${CLUSTER/${HOSTNAME/.*}} >>> output: -bash: ${HOSTNAME: bad substitution >> >> Apparently bash interprets this as ${parameter/pattern/string} >> where pattern = ${HOSTNAME. Looks like a bug; it works in ksh. > > That is, in fact, what is happening. I'm not sure you can call it > a bug, though -- bash is behaving exactly as documented. Where exactly is that documented? The only statement I can find in the documentation referring to this problem is: "When braces are used, the matching ending brace is the first `}' not escaped by a backslash or within a quoted string, and not within an embedded arithmetic expansion, command substitution, or parameter expansion." I may be wrong, but to me this means that the first opening brace matches the last closing one, and that the token ${HOSTNAME/.*} is a correct parameter expansion. Bernd -- Bernd Eggink monoped@sudrala.de http://sudrala.de From MAILER-DAEMON Fri Jan 11 18:19:12 2008 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1JDT9c-0008WT-FC for mharc-bug-bash@gnu.org; Fri, 11 Jan 2008 18:19:12 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JDT9a-0008Tt-E6 for bug-bash@gnu.org; Fri, 11 Jan 2008 18:19:10 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JDT9Y-0008RT-Bv for bug-bash@gnu.org; Fri, 11 Jan 2008 18:19:09 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JDT9Y-0008RM-93 for bug-bash@gnu.org; Fri, 11 Jan 2008 18:19:08 -0500 Received: from mpv3.tis.cwru.edu ([129.22.105.35]) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_3DES_EDE_CBC_SHA1:24) (Exim 4.60) (envelope-from ) id 1JDT9X-0005xM-Vo for bug-bash@gnu.org; Fri, 11 Jan 2008 18:19:08 -0500 Received: from mpv5.TIS.cwru.edu (mpv5.TIS.CWRU.Edu [129.22.105.51]) by mpv3.TIS.cwru.edu (MOS 3.8.6-GA) with ESMTP id CBI08373; Fri, 11 Jan 2008 18:19:05 -0500 (EST) Received: from z4.local ([71.31.147.113]) by mpv5.TIS.cwru.edu (MOS 3.8.6-GA) with ESMTP id DQK94558 (AUTH cpr); Fri, 11 Jan 2008 18:19:03 -0500 (EST) Message-ID: <4787F966.9040107@case.edu> Date: Fri, 11 Jan 2008 18:19:02 -0500 From: Chet Ramey Organization: ITS, Case Western Reserve University User-Agent: Thunderbird 2.0.0.9 (Macintosh/20071031) MIME-Version: 1.0 To: Bernd Eggink References: <4786DEEF.30409@sas.com> <47879939.4070403@sudrala.de> <4787B909.7090808@case.edu> <4787D1CE.8040602@sudrala.de> In-Reply-To: <4787D1CE.8040602@sudrala.de> X-Enigmail-Version: 0.95.6 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Junkmail-Status: score=10/49, host=mpv3.cwru.edu X-Junkmail-SD-Raw: score=unknown, refid=str=0001.0A090203.4787F96A.0013,ss=1,fgs=0, ip=71.31.147.113, so=2007-10-30 19:00:17, dmn=5.4.3/2007-11-16 X-Junkmail-IWF: false X-detected-kernel: by monty-python.gnu.org: Genre and OS details not recognized. Cc: Dmitry V Golovashkin , bug-bash@gnu.org, chet@case.edu Subject: Re: Bash string substitution bug (?) X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: chet.ramey@case.edu List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Jan 2008 23:19:11 -0000 Bernd Eggink wrote: > Chet Ramey schrieb: >> Bernd Eggink wrote: >>>> >>>> prompt: CLUSTER='1 2'; echo ${CLUSTER/${HOSTNAME/.*}} >>>> output: -bash: ${HOSTNAME: bad substitution >>> >>> Apparently bash interprets this as ${parameter/pattern/string} >>> where pattern = ${HOSTNAME. Looks like a bug; it works in ksh. >> >> That is, in fact, what is happening. I'm not sure you can call it >> a bug, though -- bash is behaving exactly as documented. > > Where exactly is that documented? The only statement I can find in the > documentation referring to this problem is: The pattern and `string' in ${parameter/pattern/string} aren't defined to obey the rules of parameter brace expansions. The search for the matching `/' is just a string search. It would be less confusing if the code that searched for the closing slash were smarter about skipping over embedded brace expansions, though. It shouldn't be too hard to change that for the next release. Chet -- ``The lyf so short, the craft so long to lerne.'' - Chaucer Live Strong. No day but today. Chet Ramey, ITS, CWRU chet@case.edu http://cnswww.cns.cwru.edu/~chet/ From MAILER-DAEMON Fri Jan 11 20:46:40 2008 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1JDVSK-0005wj-Kd for mharc-bug-bash@gnu.org; Fri, 11 Jan 2008 20:46:40 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JDVSI-0005wQ-Oj for bug-bash@gnu.org; Fri, 11 Jan 2008 20:46:38 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JDVSF-0005t5-KP for bug-bash@gnu.org; Fri, 11 Jan 2008 20:46:37 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JDVSF-0005sy-DK for bug-bash@gnu.org; Fri, 11 Jan 2008 20:46:35 -0500 Received: from mpv4.tis.cwru.edu ([129.22.105.34]) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_3DES_EDE_CBC_SHA1:24) (Exim 4.60) (envelope-from ) id 1JDVSF-0006pf-9D for bug-bash@gnu.org; Fri, 11 Jan 2008 20:46:35 -0500 Received: from mpv6.TIS.cwru.edu (mpv6.TIS.CWRU.Edu [129.22.104.221]) by mpv4.tis.cwru.edu (MOS 3.8.6-GA) with ESMTP id CGQ12592; Fri, 11 Jan 2008 20:46:33 -0500 (EST) Received: from z4.local ([71.31.147.113]) by mpv6.TIS.cwru.edu (MOS 3.8.6-GA) with ESMTP id DQT35446 (AUTH cpr); Fri, 11 Jan 2008 20:46:32 -0500 (EST) Message-ID: <47881BF6.9070502@case.edu> Date: Fri, 11 Jan 2008 20:46:30 -0500 From: Chet Ramey Organization: ITS, Case Western Reserve University User-Agent: Thunderbird 2.0.0.9 (Macintosh/20071031) MIME-Version: 1.0 To: Dave Rutherford References: <1199970787.2017.1.camel@ws1.local.fransdb.nl> <5fb589920801100636n7e3c27acsbd17147841ebb957@mail.gmail.com> <47866B22.6080507@case.edu> <5fb589920801101232m250e35f9t9e13834d1daa5fbd@mail.gmail.com> In-Reply-To: <5fb589920801101232m250e35f9t9e13834d1daa5fbd@mail.gmail.com> X-Enigmail-Version: 0.95.6 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Junkmail-Status: score=10/49, host=mpv4.tis.cwru.edu X-Junkmail-SD-Raw: score=unknown, refid=str=0001.0A090202.47881BFA.0081,ss=1,fgs=0, ip=71.31.147.113, so=2007-10-30 19:00:17, dmn=5.4.3/2007-11-16 X-Junkmail-IWF: false X-detected-kernel: by monty-python.gnu.org: Genre and OS details not recognized. Cc: Frans de Boer , bug-bash@gnu.org, chet@case.edu Subject: Re: Comparison failure X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: chet.ramey@case.edu List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 12 Jan 2008 01:46:38 -0000 Dave Rutherford wrote: > I know test's quirks. Does [[ have quirks? Are they the same? > Is there room in my grey matter to hold both sets of quirks > and keep them straight? [[ was designed to remedy test's quirks, so it shouldn't really have any of its own. In addition to the functionality provided by the new operators and extended matching there is: 1. a more regular grammar, including operator short-circuiting and better parsing ( [[ -f ]] is an error, for instance; and [[ -f = ]] doesn't throw an error like the system v test) 2. no word splitting or pathname expansion performed on arguments -- each argument ends up as a single word 3. parameter and variable expansion is more convenient, since [[ is not a command invoked after all expansions a performed. The intent is to eliminate the need for excessive quoting: [[ -n $n ]] and [ -n $n ] behave differently when `n' is unset or null; [ requires quoting arguments but even that isn't sufficient in all cases Since [[ was new and had a single specification, the intent was that users would not have to deal with the portability problems inherent in the different historical test implementations (Dave Korn implemented it in the pre-Posix era, remember). Posix tried to fix some of test's shortcomings within the constraint of leaving it a builtin command, mostly by defining the behavior based on the number of arguments and specifying some operator precedence, but [[ still has its advantages. That means that test is more portable than [[, of course. Chet -- ``The lyf so short, the craft so long to lerne.'' - Chaucer Live Strong. No day but today. Chet Ramey, ITS, CWRU chet@case.edu http://cnswww.cns.cwru.edu/~chet/ From MAILER-DAEMON Sat Jan 12 02:32:29 2008 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1JDaqz-00011k-7E for mharc-bug-bash@gnu.org; Sat, 12 Jan 2008 02:32:29 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JDaqx-00011e-8x for bug-bash@gnu.org; Sat, 12 Jan 2008 02:32:27 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JDaqv-0000zQ-I8 for bug-bash@gnu.org; Sat, 12 Jan 2008 02:32:26 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JDaqv-0000z6-CD for bug-bash@gnu.org; Sat, 12 Jan 2008 02:32:25 -0500 Received: from mercav05.na.sas.com ([149.173.6.148]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JDaqv-0005cr-3M for bug-bash@gnu.org; Sat, 12 Jan 2008 02:32:25 -0500 Received: from [10.40.13.87] ([10.40.13.87]) by mercav05.na.sas.com with InterScan Message Security Suite; Sat, 12 Jan 2008 02:32:17 -0500 Message-ID: <47886CFF.4090101@sas.com> Date: Sat, 12 Jan 2008 02:32:15 -0500 From: Dmitry V Golovashkin Organization: Advanced Computing Lab, SAS Institute Inc. User-Agent: Thunderbird 2.0.0.6 (X11/20071022) Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1; format=flowed Content-Transfer-Encoding: 7bit To: Bernd Eggink References: <4786DEEF.30409@sas.com> <47879939.4070403@sudrala.de> <4787B909.7090808@case.edu> <4787D1CE.8040602@sudrala.de> In-Reply-To: <4787D1CE.8040602@sudrala.de> X-detected-kernel: by monty-python.gnu.org: Windows 2000 SP4, XP SP1+ Cc: "bug-bash@gnu.org" , "chet.ramey@case.edu" Subject: Re: Bash string substitution bug (?) X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 12 Jan 2008 07:32:27 -0000 either VALUE=host1.blah.com echo ${VALUE//.*} or echo ${VALUE/.*} is accepted by Bash and works exactly as I would expect it - meaning it correctly produces "host1" - removes the dot (dot is just a character - we are not in the regular expression world) - so the dot and the trailing domain name are removed. Bash works fine in both above cases, produces expected output; ${VALUE/.*} naturally seems to be a valid parameter expansion. Please try once more: CLUSTER='host5 host1 host2'; VALUE=host1.blah.com; echo ${CLUSTER//${VALUE%%.*}} again works perfectly: Outputs 'host5 host2' just as i would expect it. ${VALUE%%.*} similarly to ${VALUE//.*} just removes the first dot-and-the-trailing domain name. it is logical to assume and the manual supports it that echo ${CLUSTER//${VALUE%%.*}} is a valid parameter expansion. Again - it works fine. Therefore it seems to be inconsistent that the nearly identical expansion echo ${CLUSTER//${VALUE/.*}} is throwing "bad substitution" exception. To sum things up, consider these two lines (without the "dot"): echo ${CLUSTER//${VALUE%%*}} echo ${CLUSTER//${VALUE//*}} the first works great. the second results in "bash: ${VALUE: bad substitution" It really does seem remarkably inconsistent: We have parameter expansion within parameter expansion, one works fine, nearly identical another one throws an exception... Seems a bug to me. Thanks! dm PS echo ${CLUSTER//${VALUE##.*}} also works superb - in this case ${VALUE##.*} is empty - because VALUE does not start with a dot. Bash works great here too. It is only when "//" is used - Bash misbehaves... Bernd Eggink wrote: > Chet Ramey schrieb: > >> Bernd Eggink wrote: >> >>>> prompt: CLUSTER='1 2'; echo ${CLUSTER/${HOSTNAME/.*}} >>>> output: -bash: ${HOSTNAME: bad substitution >>>> >>> Apparently bash interprets this as ${parameter/pattern/string} >>> where pattern = ${HOSTNAME. Looks like a bug; it works in ksh. >>> >> That is, in fact, what is happening. I'm not sure you can call it >> a bug, though -- bash is behaving exactly as documented. >> > > Where exactly is that documented? The only statement I can find in the > documentation referring to this problem is: > > "When braces are used, the matching ending brace is the first `}' not > escaped by a backslash or within a quoted string, and not > within an embedded arithmetic expansion, command substitution, or > parameter expansion." > > I may be wrong, but to me this means that the first opening brace > matches the last closing one, and that the token ${HOSTNAME/.*} is a > correct parameter expansion. > > Bernd > > -- > Bernd Eggink > monoped@sudrala.de > http://sudrala.de > From MAILER-DAEMON Sat Jan 12 03:14:45 2008 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1JDbVt-0001BP-N8 for mharc-bug-bash@gnu.org; Sat, 12 Jan 2008 03:14:45 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JDbVr-0001BK-WD for bug-bash@gnu.org; Sat, 12 Jan 2008 03:14:44 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JDbVo-0001At-Gy for bug-bash@gnu.org; Sat, 12 Jan 2008 03:14:43 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JDbVo-0001Ap-9k for bug-bash@gnu.org; Sat, 12 Jan 2008 03:14:40 -0500 Received: from mx20.gnu.org ([199.232.41.8]) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1JDbVn-00012l-MD for bug-bash@gnu.org; Sat, 12 Jan 2008 03:14:39 -0500 Received: from mercav04.na.sas.com ([149.173.6.152]) by mx20.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JDbVh-00041U-OM for bug-bash@gnu.org; Sat, 12 Jan 2008 03:14:33 -0500 Received: from [10.40.13.87] ([10.40.13.87]) by mercav04.na.sas.com with InterScan Message Security Suite; Sat, 12 Jan 2008 02:44:21 -0500 Message-ID: <47886FD3.9090109@sas.com> Date: Sat, 12 Jan 2008 02:44:19 -0500 From: Dmitry V Golovashkin Organization: Advanced Computing Lab, SAS Institute Inc. User-Agent: Thunderbird 2.0.0.6 (X11/20071022) Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1; format=flowed Content-Transfer-Encoding: 7bit To: "chet.ramey@case.edu" References: <4786DEEF.30409@sas.com> <47879939.4070403@sudrala.de> <4787B909.7090808@case.edu> <4787D1CE.8040602@sudrala.de> <4787F966.9040107@case.edu> In-Reply-To: <4787F966.9040107@case.edu> X-detected-kernel: by mx20.gnu.org: Windows 2000 SP4, XP SP1+ X-Greylist: delayed 1801 seconds by postgrey-1.27 at nadesico; Sat, 12 Jan 2008 03:14:32 EST X-detected-kernel: by monty-python.gnu.org: Linux 2.6, seldom 2.4 (older, 4) Cc: "bug-bash@gnu.org" , "chet@case.edu" , Bernd Eggink Subject: Re: Bash string substitution bug (?) X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 12 Jan 2008 08:14:44 -0000 Thanks a lot! :-) Chet Ramey wrote: > Bernd Eggink wrote: > >> Chet Ramey schrieb: >> >>> Bernd Eggink wrote: >>> >>>>> prompt: CLUSTER='1 2'; echo ${CLUSTER/${HOSTNAME/.*}} >>>>> output: -bash: ${HOSTNAME: bad substitution >>>>> >>>> Apparently bash interprets this as ${parameter/pattern/string} >>>> where pattern = ${HOSTNAME. Looks like a bug; it works in ksh. >>>> >>> That is, in fact, what is happening. I'm not sure you can call it >>> a bug, though -- bash is behaving exactly as documented. >>> >> Where exactly is that documented? The only statement I can find in the >> documentation referring to this problem is: >> > > The pattern and `string' in ${parameter/pattern/string} aren't defined > to obey the rules of parameter brace expansions. The search for the > matching `/' is just a string search. > > It would be less confusing if the code that searched for the closing > slash were smarter about skipping over embedded brace expansions, though. > It shouldn't be too hard to change that for the next release. > > Chet > -- > ``The lyf so short, the craft so long to lerne.'' - Chaucer > Live Strong. No day but today. > Chet Ramey, ITS, CWRU chet@case.edu http://cnswww.cns.cwru.edu/~chet/ > From MAILER-DAEMON Tue Jan 15 09:16:22 2008 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1JEmaU-0001se-LH for mharc-bug-bash@gnu.org; Tue, 15 Jan 2008 09:16:22 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JEmaT-0001sY-27 for bug-bash@gnu.org; Tue, 15 Jan 2008 09:16:21 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JEmaS-0001sM-JQ for bug-bash@gnu.org; Tue, 15 Jan 2008 09:16:20 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JEmaS-0001sJ-Dz for bug-bash@gnu.org; Tue, 15 Jan 2008 09:16:20 -0500 Received: from mx1.redhat.com ([66.187.233.31]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JEmaS-00038u-AX for bug-bash@gnu.org; Tue, 15 Jan 2008 09:16:20 -0500 Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id m0FEGDB1030562 for ; Tue, 15 Jan 2008 09:16:13 -0500 Received: from pobox.stuttgart.redhat.com (pobox.stuttgart.redhat.com [172.16.2.10]) by int-mx1.corp.redhat.com (8.13.1/8.13.1) with ESMTP id m0FEGCN9005768 for ; Tue, 15 Jan 2008 09:16:13 -0500 Received: from localhost (tjanouse.englab.brq.redhat.com [10.34.32.91]) by pobox.stuttgart.redhat.com (8.13.1/8.13.1) with ESMTP id m0FEGC1F002730 for ; Tue, 15 Jan 2008 09:16:12 -0500 Date: Tue, 15 Jan 2008 15:16:12 +0100 From: Tomas Janousek To: bug-bash@gnu.org Message-ID: <20080115141612.GA3954@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.16 (2007-06-09) X-Scanned-By: MIMEDefang 2.58 on 172.16.52.254 X-detected-kernel: by monty-python.gnu.org: Linux 2.6 (newer, 3) Subject: vi mode is unable to repeat insert actions after deletion etc. X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Jan 2008 14:16:21 -0000 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-redhat-linux-gnu' -DCONF_VENDOR='redhat' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash' -DSHELL -DHAVE_CONFIG_H -I. -I. -I./include -I./lib -D_GNU_SOURCE -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m32 -march=i386 -mtune=generic -fasynchronous-unwind-tables uname output: Linux tjanouse.englab.brq.redhat.com 2.6.18-53.el5 #1 SMP Wed Oct 10 16:34:02 EDT 2007 i686 i686 i386 GNU/Linux Machine Type: i686-redhat-linux-gnu Bash Version: 3.2 Patch Level: 33 Release Status: release Description: Whenever you do some non-inserting edit command, like 'x' or 'd', that becomes the command-to-repeat and no further insertions may be repeated. Repeat-By: 1. Start a new bash shell 2. 'set -o vi' 2. Type 'kekepophxi\.' 3. You end up with 'kekepp' instead of 'kekep\\p'. Fix: This patch fixes it and tries to fix redoing the 'I' command as well. I'm not sure about 'c', though. diff --git a/lib/readline/misc.c b/lib/readline/misc.c index e9c72c5..35d6348 100644 --- a/lib/readline/misc.c +++ b/lib/readline/misc.c @@ -560,7 +560,7 @@ rl_vi_editing_mode (count, key) #if defined (VI_MODE) _rl_set_insert_mode (RL_IM_INSERT, 1); /* vi mode ignores insert mode */ rl_editing_mode = vi_mode; - rl_vi_insertion_mode (1, key); + rl_vi_insert_mode (1, key); #endif /* VI_MODE */ return 0; diff --git a/lib/readline/readline.c b/lib/readline/readline.c index bd4d263..4b3d91b 100644 --- a/lib/readline/readline.c +++ b/lib/readline/readline.c @@ -370,7 +370,7 @@ readline_internal_setup () #if defined (VI_MODE) if (rl_editing_mode == vi_mode) - rl_vi_insertion_mode (1, 'i'); + rl_vi_insert_mode (1, 'i'); #endif /* VI_MODE */ if (rl_pre_input_hook) diff --git a/lib/readline/readline.h b/lib/readline/readline.h index b71bf98..8527ebf 100644 --- a/lib/readline/readline.h +++ b/lib/readline/readline.h @@ -230,6 +230,7 @@ extern int rl_vi_next_word PARAMS((int, int)); extern int rl_vi_end_word PARAMS((int, int)); extern int rl_vi_insert_beg PARAMS((int, int)); extern int rl_vi_append_mode PARAMS((int, int)); +extern int rl_vi_insert_mode PARAMS((int, int)); extern int rl_vi_append_eol PARAMS((int, int)); extern int rl_vi_eof_maybe PARAMS((int, int)); extern int rl_vi_insertion_mode PARAMS((int, int)); diff --git a/lib/readline/vi_keymap.c b/lib/readline/vi_keymap.c index 4b48c75..3a017cc 100644 --- a/lib/readline/vi_keymap.c +++ b/lib/readline/vi_keymap.c @@ -151,7 +151,7 @@ KEYMAP_ENTRY_ARRAY vi_movement_keymap = { { ISFUNC, rl_vi_char_search }, /* f */ { ISFUNC, (rl_command_func_t *)0x0 }, /* g */ { ISFUNC, rl_backward_char }, /* h */ - { ISFUNC, rl_vi_insertion_mode }, /* i */ + { ISFUNC, rl_vi_insert_mode }, /* i */ { ISFUNC, rl_get_next_history }, /* j */ { ISFUNC, rl_get_previous_history }, /* k */ { ISFUNC, rl_forward_char }, /* l */ diff --git a/lib/readline/vi_mode.c b/lib/readline/vi_mode.c index b0da0ab..e859062 100644 --- a/lib/readline/vi_mode.c +++ b/lib/readline/vi_mode.c @@ -220,6 +220,15 @@ rl_vi_redo (count, c) if (rl_point > 0) _rl_vi_backup (); } + /* Ditto for redoing an insert with `I', but move to the beginning of line + like the `I' command does. */ + else if (_rl_vi_last_command == 'I' && vi_insert_buffer && *vi_insert_buffer) + { + rl_beg_of_line (1, 'I'); + _rl_vi_stuff_insert (count); + if (rl_point > 0) + _rl_vi_backup (); + } else r = _rl_dispatch (_rl_vi_last_command, _rl_keymap); vi_redoing = 0; @@ -584,7 +593,7 @@ rl_vi_insert_beg (count, key) int count, key; { rl_beg_of_line (1, key); - rl_vi_insertion_mode (1, key); + rl_vi_insert_mode (1, key); return (0); } @@ -618,6 +627,14 @@ rl_vi_append_mode (count, key) } int +rl_vi_insert_mode (count, key) + int count, key; +{ + rl_vi_start_inserting (key, 1, rl_arg_sign); + return (0); +} + +int rl_vi_append_eol (count, key) int count, key; { @@ -690,7 +707,7 @@ _rl_vi_done_inserting () } else { - if ((_rl_vi_last_key_before_insert == 'i' || _rl_vi_last_key_before_insert == 'a') && rl_undo_list) + if ((_rl_vi_last_key_before_insert == 'i' || _rl_vi_last_key_before_insert == 'a' || _rl_vi_last_key_before_insert == 'I') && rl_undo_list) _rl_vi_save_insert (rl_undo_list); /* XXX - Other keys probably need to be checked. */ else if (_rl_vi_last_key_before_insert == 'C') -- Tomas Janousek, SW Engineer, Red Hat, Inc. From MAILER-DAEMON Wed Jan 16 05:49:33 2008 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1JF5ps-00055T-ME for mharc-bug-bash@gnu.org; Wed, 16 Jan 2008 05:49:32 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JF5po-00051i-PO for bug-bash@gnu.org; Wed, 16 Jan 2008 05:49:29 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JF5pj-0004wB-Ro for bug-bash@gnu.org; Wed, 16 Jan 2008 05:49:25 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JF5pi-0004vn-Cr for bug-bash@gnu.org; Wed, 16 Jan 2008 05:49:22 -0500 Received: from mail.mppmu.mpg.de ([134.107.24.11]) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1JF5ph-0000A3-59 for bug-bash@gnu.org; Wed, 16 Jan 2008 05:49:21 -0500 Received: by mail.mppmu.mpg.de (Postfix, from userid 998) id 339EB12025; Wed, 16 Jan 2008 11:49:17 +0100 (CET) Received: from pcl321.mppmu.mpg.de (pcl321.mppmu.mpg.de [134.107.3.54]) by mail.mppmu.mpg.de (Postfix) with ESMTP id 0D31F12034; Wed, 16 Jan 2008 11:49:17 +0100 (CET) Received: from pcl321.mppmu.mpg.de (localhost [127.0.0.1]) by pcl321.mppmu.mpg.de (8.14.2/8.14.1) with ESMTP id m0GAnGwq002693; Wed, 16 Jan 2008 11:49:16 +0100 Received: (from peb@localhost) by pcl321.mppmu.mpg.de (8.14.2/8.14.2/Submit) id m0GAnGjt002692; Wed, 16 Jan 2008 11:49:16 +0100 Date: Wed, 16 Jan 2008 11:49:16 +0100 Message-Id: <200801161049.m0GAnGjt002692@pcl321.mppmu.mpg.de> From: Peter Breitenlohner To: bug-bash@gnu.org X-detected-kernel: by monty-python.gnu.org: Linux 2.4-2.6 Cc: peb@mppmu.mpg.de Subject: bash manpage problems + patch X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Jan 2008 10:49:30 -0000 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/share/locale' -DPACKAGE='bash' -DSHELL -DHAVE_CONFIG_H -I. -I../bash-3.2 -I../bash-3.2/include -I../bash-3.2/lib -O2 uname output: Linux pcl321 2.6.20-i686 #3 SMP Fri Mar 23 15:31:48 CET 2007 i686 GNU/Linux Machine Type: i686-pc-linux-gnu Bash Version: 3.2 Patch Level: 33 Release Status: release Description: (1) The bash.1 manpage suffers from a rather ugly formatting problem due to a typo. (2) I like the bash_builtins.1 manpage, which is, however, not installed by the distributed Makefile.in. Unfortunately that manpage cannot be displayed by all man browsers (man-db and possibly others as well). Whereas AFAIK all man browsers understand ".so man1/bash.1" only some of them understand ".so bash.1". (3) It would be nice if the bash_builtins.1 manpage could be installed without modifying Makefile.in (and without doing it manually), e.g., via a configure option or a make variable specified on the make command line. Repeat-By: (1) Say "man bash" and search for the paragraph starting with "${parameter/pattern/string}" in the section "Parameter Expansion". (2) Install bash_builtins.1 on a system using man-db (e.g., debian or suse) and try "man bash_builtins". Fix: For (1) and (2) apply these two patches. -------------- cut here --------------- diff -ur -x configure bash-3.2.orig/doc/bash.1 bash-3.2/doc/bash.1 --- bash-3.2.orig/doc/bash.1 2006-10-03 14:54:26.000000000 +0200 +++ bash-3.2/doc/bash.1 2008-01-15 19:44:43.000000000 +0100 @@ -2539,7 +2539,7 @@ pathname expansion. \fIParameter\fP is expanded and the longest match of \fIpattern\fP against its value is replaced with \fIstring\fP. -If \Ipattern\fP begins with \fB/\fP, all matches of \fIpattern\fP are +If \fIpattern\fP begins with \fB/\fP, all matches of \fIpattern\fP are replaced with \fIstring\fP. Normally only the first match is replaced. If \fIpattern\fP begins with \fB#\fP, it must match at the beginning of the expanded value of \fIparameter\fP. -------------- cut here --------------- diff -ur bash-3.2.orig/doc/builtins.1 bash-3.2/doc/builtins.1 --- bash-3.2.orig/doc/builtins.1 2004-05-24 16:19:55.000000000 +0200 +++ bash-3.2/doc/builtins.1 2007-03-28 22:20:48.000000000 +0200 @@ -10,6 +10,6 @@ ulimit, umask, unalias, unset, wait \- bash built-in commands, see \fBbash\fR(1) .SH BASH BUILTIN COMMANDS .nr zZ 1 -.so bash.1 +.so man1/bash.1 .SH SEE ALSO bash(1), sh(1) -------------- cut here --------------- It would be nice if something could be done about (3). From MAILER-DAEMON Wed Jan 16 11:37:00 2008 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1JFBG8-0007NS-Kv for mharc-bug-bash@gnu.org; Wed, 16 Jan 2008 11:37:00 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JEtrG-0002dZ-GP for bug-bash@gnu.org; Tue, 15 Jan 2008 17:02:10 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JEtrD-0002cr-SI for bug-bash@gnu.org; Tue, 15 Jan 2008 17:02:10 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JEtrD-0002co-M3 for bug-bash@gnu.org; Tue, 15 Jan 2008 17:02:07 -0500 Received: from iorek.ice-nine.org ([74.41.74.233]) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1JEtrD-0003ME-6l for bug-bash@gnu.org; Tue, 15 Jan 2008 17:02:07 -0500 Received: from iorek.ice-nine.org (jrrs@localhost.ice-nine.org [127.0.0.1]) by iorek.ice-nine.org (8.13.8/8.14.0) with ESMTP id m0FM1l8j018051 (version=TLSv1/SSLv3 cipher=DHE-DSS-AES256-SHA bits=256 verify=NO) for ; Tue, 15 Jan 2008 17:01:53 -0500 (EST) Received: (from jrrs@localhost) by iorek.ice-nine.org (8.13.8/8.13.8/Submit) id m0FM1lDp021260; Tue, 15 Jan 2008 17:01:47 -0500 (EST) Date: Tue, 15 Jan 2008 17:01:47 -0500 (EST) From: jared r r spiegel Message-Id: <200801152201.m0FM1lDp021260@iorek.ice-nine.org> To: bug-bash@gnu.org X-detected-kernel: by monty-python.gnu.org: OpenBSD 3.0-3.9 X-Mailman-Approved-At: Wed, 16 Jan 2008 11:36:59 -0500 Subject: premature execution of command substution during tab completion solicitation X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Jan 2008 22:02:10 -0000 Configuration Information [Automatically generated, do not change]: Machine: i386 OS: openbsd4.0 Compiler: cc Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='i386' -DCONF_OSTYPE='openbsd4.0' -DCONF_MACHTYPE='i386-unknown-openbsd4.0' -DCONF_VENDOR='unknown' -DLOCALEDIR='/usr/local/share/locale' -DPACKAGE='bash' -DSHELL -DHAVE_CONFIG_H -I. -I. -I./include -I./lib -I/usr/local/include -O2 -pipe uname output: OpenBSD iorek.ice-nine.org 4.0 IOREK.MP#1 i386 Machine Type: i386-unknown-openbsd4.0 Bash Version: 3.1 Patch Level: 17 Release Status: release Description: unexpected execution of incomplete (and currently syntactically invalid?) commandline by tab-completion subsystem Repeat-By: enter ``"$(echo $RANDOM >/dev/stderr) /dev/null'' a the command prompt (with .Dq removed). note the \" at the beginning of line has no matching end quote. the cursor in my case is directly after the last 'l', as if i had just finished typing null, however it doesn't seem to be utterly critical to the duplication. hit tab a lot. my term looks like this: bash-3.1$ "$(echo $RANDOM >/dev/stderr) /dev/null 20560 nullnull bash-3.1$ "$(echo $RANDOM >/dev/stderr) /dev/null 26528 nullnull bash-3.1$ "$(echo $RANDOM >/dev/stderr) /dev/null 13871 nullnull bash-3.1$ "$(echo $RANDOM >/dev/stderr) /dev/null 18086 nullnull bash-3.1$ "$(echo $RANDOM >/dev/stderr) /dev/null bash is prematurely executing command substitutions inside the open quote. tested some other unterminated tokens: " - happens ' - happens ( - appears safe { - appears safe `command` shows the behaviour same as $(command). also duplicated with current bash '3.1dfsg-8' from debian current (which has the same $BASH_VERSION string of 3.1.17(1)-release) From MAILER-DAEMON Thu Jan 17 16:46:13 2008 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1JFcYv-0004cD-LO for mharc-bug-bash@gnu.org; Thu, 17 Jan 2008 16:46:13 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JFcYt-0004bR-M3 for bug-bash@gnu.org; Thu, 17 Jan 2008 16:46:11 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JFcYr-0004a0-QH for bug-bash@gnu.org; Thu, 17 Jan 2008 16:46:11 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JFcYr-0004Zo-D3 for bug-bash@gnu.org; Thu, 17 Jan 2008 16:46:09 -0500 Received: from server.klug.on.ca ([205.189.48.131]) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1JFcYr-0001T9-5j for bug-bash@gnu.org; Thu, 17 Jan 2008 16:46:09 -0500 Received: from linux.interlinx.bc.ca (d193-45-68.home3.cgocable.net [67.193.45.68]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by server.klug.on.ca (Postfix) with ESMTP id AD5FB2803 for ; Thu, 17 Jan 2008 16:46:06 -0500 (EST) Received: from [10.75.22.1] (pc.ilinx [10.75.22.1]) by linux.interlinx.bc.ca (Postfix) with ESMTP id 9925186EE for ; Thu, 17 Jan 2008 16:46:05 -0500 (EST) From: "Brian J. Murrell" To: bug-bash@gnu.org Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="=-pqyaW8yNk8gNyhu9+dno" Date: Thu, 17 Jan 2008 16:31:27 -0500 Message-Id: <1200605487.7959.42.camel@pc.ilinx> Mime-Version: 1.0 X-Mailer: Evolution 2.21.5 X-detected-kernel: by monty-python.gnu.org: Linux 2.6, seldom 2.4 (older, 4) Subject: time limiting command execution X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Jan 2008 21:46:11 -0000 --=-pqyaW8yNk8gNyhu9+dno Content-Type: text/plain Content-Transfer-Encoding: quoted-printable I am trying to write a function to (wall-clock) timelimit a command's execution time but damned if I cannot eliminate all of the races. Here is my current iteration of the function: 1 timed_run() { 2 local SLEEP_TIME=3D$1 3 shift 4 5 set +o monitor 6 7 # start command running 8 # NOTE: if you put the & after the bash -c "" the & will background 9 # setsid which causes a race trying to kill the PGID that setsid trie= s 10 # to create 11 setsid bash -c "$@" & 12 local child_pid=3D$! 13 # wait for setsid to have done it's work 14 while ! kill -0 -$child_pid 2>/dev/null; do 15 sleep 1 16 done 17 =20 18 # 19 # start the watchdog 20 # - use setsid to put all of the children of the watchdog into their 21 # own process group so that we can use kill - to kill them 22 # all off 27 setsid bash -c "sleep $SLEEP_TIME 28 echo \"$1 was killed due to a $SLEEP_TIME second timeout expiry\" 29 kill -TERM -$child_pid 2>/dev/null 30 sleep 5 41 kill -KILL -$child_pid 2>/dev/null" & 42 local dog_pid=3D$! 43 # wait for setsid to have done it's work 44 while ! kill -0 -$dog_pid 2>/dev/null; do 45 sleep 1 46 done 47 48 # waiting on the command will end when either it completes or the 49 # watchdog kills it 50 wait $child_pid 51 52 # status of the child command will be set to 143 if the process had 53 # to be killed due to timeout 54 child_status=3D${PIPESTATUS[0]} 55 56 # kill off the watchdog 57 kill -TERM -$dog_pid 58 59 # return the command's status back to the caller 60 return $child_status 61} Some notes: * the setsids are needed to allow kill to kill off a whole group of processes * set +o monitor is to disable job control notification messages (i.e. Killed, Done, etc.) * the kill -0 calls are needed to ensure that setsid has finished it's work (i.e. created a new program group) and that a subsequent kill ... - will not be called before the setsid is done All of that leaves one race still. The process (group) that setsid creates could be done (and gone) before the kill -0 is called. But if I eliminate the kill -0 then I can't be sure that the setsid has created the process group before calling the kill on it to kill off the processes. I have tried an alternate solution where I can be sure that setsid has done it's work: 1 timed_run() { 2 local SLEEP_TIME=3D$1 3 shift 4 5 set +o monitor 6 7 # start command running 8 # NOTE: if you put the & after the bash -c "" the & will background 9 # setsid which causes a race trying to kill the PGID that setsid trie= s 10 # to create 11 setsid bash -c "($@) &" 12 local child_pid=3D??? 17 =20 18 # 19 # start the watchdog 20 # - use setsid to put all of the children of the watchdog into their 21 # own process group so that we can use kill - to kill them 22 # all off 27 setsid bash -c "(sleep $SLEEP_TIME 28 echo \"$1 was killed due to a $SLEEP_TIME second timeout expiry\" 29 kill -TERM -$child_pid 2>/dev/null 30 sleep 5 41 kill -KILL -$child_pid 2>/dev/null) &" 42 local dog_pid=3D??? 47 48 # waiting on the command will end when either it completes or the 49 # watchdog kills it 50 wait $child_pid 51 52 # status of the child command will be set to 143 if the process had 53 # to be killed due to timeout 54 child_status=3D${PIPESTATUS[0]} 55 56 # kill off the watchdog 57 kill -TERM -$dog_pid 58 59 # return the command's status back to the caller 60 return $child_status 61} Notice that I put the & *inside* the bash commands so that the bash command is backgrounded and not setsid (as in the previous iteration). That allows me to get rid of the kill -0 races on lines 14 and 44 but I lose the ability to learn the pgids that setsid creates which I need to kill on lines 29/41 or 57. Now, the pgids that I want to know are the pids of the two bash commands that the setsids create. So I could almost do: 1 timed_run() { 2 local SLEEP_TIME=3D$1 3 shift 4 5 set +o monitor 6 7 # start command running 8 # NOTE: if you put the & after the bash -c "" the & will background 9 # setsid which causes a race trying to kill the PGID that setsid trie= s 10 # to create 11 child_pid=3D$(setsid bash -c "echo \$\$; ($@) &" 17 =20 18 # 19 # start the watchdog 20 # - use setsid to put all of the children of the watchdog into their 21 # own process group so that we can use kill - to kill them 22 # all off 27 dog_pid=3D$(setsid bash -c "(sleep $SLEEP_TIME 28 echo \"$1 was killed due to a $SLEEP_TIME second timeout expiry\" 29 kill -TERM -$child_pid 2>/dev/null 30 sleep 5 41 kill -KILL -$child_pid 2>/dev/null) &") 47 48 # waiting on the command will end when either it completes or the 49 # watchdog kills it 50 wait $child_pid 51 52 # status of the child command will be set to 143 if the process had 53 # to be killed due to timeout 54 child_status=3D${PIPESTATUS[0]} 55 56 # kill off the watchdog 57 kill -TERM -$dog_pid 58 59 # return the command's status back to the caller 60 return $child_status 61} Except that I want whatever stdout/stderr the command that is in $@ on line 11 produces to stay on stdout/stderr so that timed_run()s caller can collect it. Probably I can put the echo on line 28 to stderr and that will solve the problem for that one. I am still left with the first issue. Any ideas? Thanx, b. --=-pqyaW8yNk8gNyhu9+dno Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) iD8DBQBHj8kvl3EQlGLyuXARAlqQAKDnBugLUs5Ec0Hkr0M2j2xfz9h4oACgoO6D 9Q71bxMf9zMXlOU679PmHdw= =nllE -----END PGP SIGNATURE----- --=-pqyaW8yNk8gNyhu9+dno-- From MAILER-DAEMON Fri Jan 18 11:05:22 2008 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1JFtic-0001Ab-JA for mharc-bug-bash@gnu.org; Fri, 18 Jan 2008 11:05:22 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JFtib-0001AG-5c for bug-bash@gnu.org; Fri, 18 Jan 2008 11:05:21 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JFtiY-00019C-Ao for bug-bash@gnu.org; Fri, 18 Jan 2008 11:05:20 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JFtiY-000191-0v for bug-bash@gnu.org; Fri, 18 Jan 2008 11:05:18 -0500 Received: from mpv2.tis.cwru.edu ([129.22.105.37]) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_3DES_EDE_CBC_SHA1:24) (Exim 4.60) (envelope-from ) id 1JFtiX-0008Bx-JK for bug-bash@gnu.org; Fri, 18 Jan 2008 11:05:17 -0500 Received: from mpv5.TIS.cwru.edu (mpv5.TIS.CWRU.Edu [129.22.105.51]) by mpv2.tis.cwru.edu (MOS 3.8.6-GA) with ESMTP id CQA30493; Fri, 18 Jan 2008 11:05:10 -0500 (EST) Received: from z4.local ([71.31.156.195]) by mpv5.TIS.cwru.edu (MOS 3.8.6-GA) with ESMTP id DSH31212 (AUTH cpr); Fri, 18 Jan 2008 11:05:03 -0500 (EST) Message-ID: <4790CE28.8060908@case.edu> Date: Fri, 18 Jan 2008 11:04:56 -0500 From: Chet Ramey Organization: ITS, Case Western Reserve University User-Agent: Thunderbird 2.0.0.9 (Macintosh/20071031) MIME-Version: 1.0 To: jared r r spiegel References: <200801152201.m0FM1lDp021260@iorek.ice-nine.org> In-Reply-To: <200801152201.m0FM1lDp021260@iorek.ice-nine.org> X-Enigmail-Version: 0.95.6 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Junkmail-Status: score=10/49, host=mpv2.tis.cwru.edu X-Junkmail-SD-Raw: score=unknown, refid=str=0001.0A09020B.4790CE3A.0161,ss=1,fgs=0, ip=71.31.156.195, so=2007-10-30 19:00:17, dmn=5.4.3/2007-11-16 X-Junkmail-IWF: false X-detected-kernel: by monty-python.gnu.org: Genre and OS details not recognized. Cc: bug-bash@gnu.org, chet@case.edu Subject: Re: premature execution of command substution during tab completion solicitation X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: chet.ramey@case.edu List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Jan 2008 16:05:21 -0000 jared r r spiegel wrote: > Configuration Information [Automatically generated, do not change]: > Machine: i386 > OS: openbsd4.0 > Compiler: cc > Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='i386' -DCONF_OSTYPE='openbsd4.0' -DCONF_MACHTYPE='i386-unknown-openbsd4.0' -DCONF_VENDOR='unknown' -DLOCALEDIR='/usr/local/share/locale' -DPACKAGE='bash' -DSHELL -DHAVE_CONFIG_H -I. -I. -I./include -I./lib -I/usr/local/include -O2 -pipe > uname output: OpenBSD iorek.ice-nine.org 4.0 IOREK.MP#1 i386 > Machine Type: i386-unknown-openbsd4.0 > > Bash Version: 3.1 > Patch Level: 17 > Release Status: release > > Description: > unexpected execution of incomplete (and currently syntactically invalid?) > commandline by tab-completion subsystem The problem is the completion system's attempt to run the directory portion of the filename to be completed through the set of shell word expansions. It's not appropriate to perform command substitution in that case. This will be fixed for the next bash version. Chet -- ``The lyf so short, the craft so long to lerne.'' - Chaucer Live Strong. No day but today. Chet Ramey, ITS, CWRU chet@case.edu http://cnswww.cns.cwru.edu/~chet/ From MAILER-DAEMON Fri Jan 18 23:15:46 2008 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1JG57S-0007zK-FK for mharc-bug-bash@gnu.org; Fri, 18 Jan 2008 23:15:46 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JFztS-0001qu-Dm for bug-bash@gnu.org; Fri, 18 Jan 2008 17:40:58 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JFztP-0001nk-K0 for bug-bash@gnu.org; Fri, 18 Jan 2008 17:40:58 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JFztP-0001nX-Fr for bug-bash@gnu.org; Fri, 18 Jan 2008 17:40:55 -0500 Received: from web51410.mail.re2.yahoo.com ([206.190.38.189]) by monty-python.gnu.org with smtp (Exim 4.60) (envelope-from ) id 1JFztP-000723-6C for bug-bash@gnu.org; Fri, 18 Jan 2008 17:40:55 -0500 Received: (qmail 47572 invoked by uid 60001); 18 Jan 2008 22:40:49 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=X-YMail-OSG:Received:Date:From:Subject:To:MIME-Version:Content-Type:Content-Transfer-Encoding:Message-ID; b=Mow7HGyy6ycIPjV+mZ8lLdkffU8qMMMpgFIvAWfhyKPAAElQaZcRK5DubxNPhZ0jahw8dBQ3i+E6zCZWHlsipSirG/pBsxQH9E7i3MNELmeuVrgzK3Y5SjH2yHvOcz3Vglbs+8Jlptr1BDZiTOr9fna9cwABqKq7hZs8Y10HMLY=; X-YMail-OSG: bLuGx20VM1mmXgZbjY4dAZ._nfBBUsGHDvf2xNZQrOoCWKM5EZ0Q.g9KxKgZ2OaMED28l4kzBnzLSdof4fs3cvxVHpwkbW3YOoMDdOQMjRr2U5i1fME- Received: from [200.109.38.166] by web51410.mail.re2.yahoo.com via HTTP; Fri, 18 Jan 2008 14:40:48 PST Date: Fri, 18 Jan 2008 14:40:48 -0800 (PST) From: Andres Sajo To: bug-bash@gnu.org, bash@packages.debian.org MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Message-ID: <278507.47463.qm@web51410.mail.re2.yahoo.com> X-detected-kernel: by monty-python.gnu.org: FreeBSD 6.x (1) X-Mailman-Approved-At: Fri, 18 Jan 2008 23:15:45 -0500 Cc: Subject: "Bad substitution error" is not "well" reported, when invoking and array. X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Jan 2008 22:40:58 -0000 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' -DCONF_VENDOR='pc' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash' -DSHELL -DHAVE_CONFIG_H -I. -I../bash -I../bash/include -I../bash/lib -g -O2 -Wall uname output: Linux tasse 2.6.22-14-generic #1 SMP Tue Dec 18 08:02:57 UTC 2007 i686 GNU/Linux Machine Type: i486-pc-linux-gnu Bash Version: 3.2 Patch Level: 25 Release Status: release Description: "Bad substitution error" is not "well" reported, when invoking and array: VAR='([0]=first [1]=second)' ${VAR[0] } works, but ${ VAR[0]} dosen't Repeat-By: andres@tasse:~$ declare -a NAME[0]="Andres" NAME[1]="Sajo" andres@tasse:~$ declare -p NAME declare -a NAME='([0]="Andres" [1]="Sajo")' ## Command 1 andres@tasse:~$ echo ${ NAME[0]} bash: ${ NAME[0]}: bad substitution ##Command 2 andres@tasse:~$ echo ${NAME[0] } Andres ##Should have reported the previous error andres@tasse:~$ echo ${NAME[0]} Andres ## The "bad substitution error" should be OR in both Commands OR in none of them. Fix: None ____________________________________________________________________________________ Never miss a thing. Make Yahoo your home page. http://www.yahoo.com/r/hs From MAILER-DAEMON Fri Jan 18 23:15:46 2008 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1JG57S-0007zW-NB for mharc-bug-bash@gnu.org; Fri, 18 Jan 2008 23:15:46 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JG3xv-0003Bj-QS for bug-bash@gnu.org; Fri, 18 Jan 2008 22:01:51 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JG3xu-0003BB-5S for bug-bash@gnu.org; Fri, 18 Jan 2008 22:01:51 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JG3xt-0003B7-Tc for bug-bash@gnu.org; Fri, 18 Jan 2008 22:01:49 -0500 Received: from an-out-0708.google.com ([209.85.132.248]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JG3xt-0005u6-K8 for bug-bash@gnu.org; Fri, 18 Jan 2008 22:01:49 -0500 Received: by an-out-0708.google.com with SMTP id c25so239084ana.84 for ; Fri, 18 Jan 2008 19:01:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:user-agent:mime-version:to:subject:content-type:content-transfer-encoding; bh=TDcDktvNpFEnSIrkkiJdhxe9JqR2xuS/zGzoZ8UDu9I=; b=pNYUFTylw2fbcJt6j8WGGSu0ujUjiHSQzAHe3DT8VQEGd8+/3O4AxpFoMbOq6+Eid3EUEIebN9nJHdK2MipAhs0O/Ln4cPmazb/HaClWNXRjRGGB593YG+OK509aoO11+dk+KYjXrs4riVVD2MJRmj8w1TSdxdGiS7Q5Sy0Svv4= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:subject:content-type:content-transfer-encoding; b=xUk8TNvZRbhnAtOQQH1SjeYDetTr8XZJiAmQ4pqNT69Nq4bFahrW75Luu+uWa4se2tbrZkO4AytzgVqQ5vjU4qKDiiXK2N56ZdQL5Vcx+C6MgrfzBhIu/EU07Y2wsd2AH1mNkcvpkYNOYqaw9if2UdcFDwQepeYsCbvSn00b3RI= Received: by 10.100.249.9 with SMTP id w9mr8667532anh.44.1200711708035; Fri, 18 Jan 2008 19:01:48 -0800 (PST) Received: from ?192.168.5.7? ( [74.192.223.207]) by mx.google.com with ESMTPS id 26sm7068502wrl.29.2008.01.18.19.01.45 (version=TLSv1/SSLv3 cipher=RC4-MD5); Fri, 18 Jan 2008 19:01:47 -0800 (PST) Message-ID: <47916671.1090101@gmail.com> Date: Fri, 18 Jan 2008 20:54:41 -0600 From: William Tambe User-Agent: Thunderbird 2.0.0.9 (X11/20071031) MIME-Version: 1.0 To: bug-bash@gnu.org Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-detected-kernel: by monty-python.gnu.org: Linux 2.6 (newer, 2) X-Mailman-Approved-At: Fri, 18 Jan 2008 23:15:45 -0500 Subject: bash does not jump where it is supposed to jump X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 19 Jan 2008 03:01:51 -0000 Please read the comments on the code below. I don't know but is it really how bash was supposed to run? The code below should only print end [ "test" = "test" ] && { # after the false command bash should jump directly to echo end # but instead run echo echo "test != test" false } || { echo "test != test" } echo end From MAILER-DAEMON Sat Jan 19 04:36:54 2008 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1JGA8D-0000DO-Tm for mharc-bug-bash@gnu.org; Sat, 19 Jan 2008 04:36:53 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JGA8C-0000BJ-0C for bug-bash@gnu.org; Sat, 19 Jan 2008 04:36:52 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JGA89-00009a-HO for bug-bash@gnu.org; Sat, 19 Jan 2008 04:36:50 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JGA89-00009P-B8 for bug-bash@gnu.org; Sat, 19 Jan 2008 04:36:49 -0500 Received: from mailout03.sul.t-online.de ([194.25.134.81] helo=mailout03.sul.t-online.com) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JGA88-0006qt-UY for bug-bash@gnu.org; Sat, 19 Jan 2008 04:36:49 -0500 Received: from fwd34.aul.t-online.de by mailout03.sul.t-online.com with smtp id 1JGA85-0001k7-04; Sat, 19 Jan 2008 10:36:45 +0100 Received: from mail.home.thebonsai.de (Z2trKZZUwhjIIlZ4V-zISLzgpDeSw2r3kNYU3ARUmBlEb6963bPICu94W2lxvF9wbe@[84.147.91.202]) by fwd34.aul.t-online.de with esmtp id 1JGA7r-0yjbjk0; Sat, 19 Jan 2008 10:36:31 +0100 Received: from [192.168.64.3] (mainserver.home.thebonsai.de [192.168.64.3]) by mail.home.thebonsai.de (Postfix) with ESMTP id 67BB66B10E; Sat, 19 Jan 2008 10:36:31 +0100 (CET) Message-ID: <4791C49E.8080609@web.de> Date: Sat, 19 Jan 2008 10:36:30 +0100 From: Jan Schampera User-Agent: IceDove 1.5.0.14pre (X11/20071018) MIME-Version: 1.0 To: William Tambe References: In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-ID: Z2trKZZUwhjIIlZ4V-zISLzgpDeSw2r3kNYU3ARUmBlEb6963bPICu94W2lxvF9wbe@t-dialin.net X-TOI-MSGID: 807afb2f-a6c4-4a26-9977-20aa7f4537ad X-detected-kernel: by monty-python.gnu.org: Linux 2.6 (newer, 3) Cc: bug-bash@gnu.org Subject: Re: bash does not jump where it is supposed to jump X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 19 Jan 2008 09:36:52 -0000 William Tambe wrote: > The code below should only print end > [ "test" = "test" ] && { > # after the false command bash should jump directly to echo end > # but instead run echo echo "test != test" > false > } || { > echo "test != test" > } > > echo end It's okay like that, it's like lists (&&, || chained commands) should work. If it's not safe for you, just use an ''if'': ----snipsnap---- if [ "test" = "test" ]; then false else echo "test != test" fi echo end ----snipsnap---- J. From MAILER-DAEMON Sat Jan 19 04:50:05 2008 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1JGAKz-0000p9-FG for mharc-bug-bash@gnu.org; Sat, 19 Jan 2008 04:50:05 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JGAKw-0000o4-Ny for bug-bash@gnu.org; Sat, 19 Jan 2008 04:50:02 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JGAKu-0000kc-Rl for bug-bash@gnu.org; Sat, 19 Jan 2008 04:50:01 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JGAKu-0000kD-Kv for bug-bash@gnu.org; Sat, 19 Jan 2008 04:50:00 -0500 Received: from cantor.suse.de ([195.135.220.2] helo=mx1.suse.de) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1JGAKt-0001sS-UB for bug-bash@gnu.org; Sat, 19 Jan 2008 04:50:00 -0500 Received: from Relay2.suse.de (mail2.suse.de [195.135.221.8]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.suse.de (Postfix) with ESMTP id A4111261E2; Sat, 19 Jan 2008 10:49:55 +0100 (CET) From: Andreas Schwab To: William Tambe References: <47916671.1090101@gmail.com> X-Yow: UH-OH!! We're out of AUTOMOBILE PARTS and RUBBER GOODS! Date: Sat, 19 Jan 2008 10:49:55 +0100 In-Reply-To: <47916671.1090101@gmail.com> (William Tambe's message of "Fri\, 18 Jan 2008 20\:54\:41 -0600") Message-ID: User-Agent: Gnus/5.110006 (No Gnus v0.6) Emacs/22.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable X-detected-kernel: by monty-python.gnu.org: Linux 2.4-2.6 Cc: bug-bash@gnu.org Subject: Re: bash does not jump where it is supposed to jump X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 19 Jan 2008 09:50:02 -0000 William Tambe writes: > [ "test" =3D "test" ] && { > # after the false command bash should jump directly to echo end > # but instead run echo echo "test !=3D test" > false > } || { > echo "test !=3D test" > } true && false is false, thus the echo is executed. Andreas. --=20 Andreas Schwab, SuSE Labs, schwab@suse.de SuSE Linux Products GmbH, Maxfeldstra=DFe 5, 90409 N=FCrnberg, Germany PGP key fingerprint =3D 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED= 5 "And now for something completely different." From MAILER-DAEMON Sat Jan 19 05:03:28 2008 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1JGAXu-0008CN-8h for mharc-bug-bash@gnu.org; Sat, 19 Jan 2008 05:03:26 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JGAXp-0008Ar-RO for bug-bash@gnu.org; Sat, 19 Jan 2008 05:03:22 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JGAXk-00087a-Lk for bug-bash@gnu.org; Sat, 19 Jan 2008 05:03:20 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JGAXk-000878-6x for bug-bash@gnu.org; Sat, 19 Jan 2008 05:03:16 -0500 Received: from mailout10.sul.t-online.de ([194.25.134.21] helo=mailout10.sul.t-online.com) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JGAXj-0004wW-ON for bug-bash@gnu.org; Sat, 19 Jan 2008 05:03:15 -0500 Received: from fwd31.aul.t-online.de by mailout10.sul.t-online.com with smtp id 1JGAXc-0002eH-01; Sat, 19 Jan 2008 11:03:08 +0100 Received: from mail.home.thebonsai.de (ZXSYlUZHQhu72O9TWJKj0I56tNu9VJ5kkvxg39RhZp4l-X6y7bvBvKNAxJkMrscQmo@[84.147.91.202]) by fwd31.aul.t-online.de with esmtp id 1JGAXY-0nyE2S0; Sat, 19 Jan 2008 11:03:04 +0100 Received: from [192.168.64.3] (mainserver.home.thebonsai.de [192.168.64.3]) by mail.home.thebonsai.de (Postfix) with ESMTP id 4D5B96B153; Sat, 19 Jan 2008 11:03:04 +0100 (CET) Message-ID: <4791CAD7.2050501@web.de> Date: Sat, 19 Jan 2008 11:03:03 +0100 From: Jan Schampera User-Agent: IceDove 1.5.0.14pre (X11/20071018) MIME-Version: 1.0 To: chet.ramey@case.edu References: <1199970787.2017.1.camel@ws1.local.fransdb.nl> <5fb589920801100636n7e3c27acsbd17147841ebb957@mail.gmail.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-ID: ZXSYlUZHQhu72O9TWJKj0I56tNu9VJ5kkvxg39RhZp4l-X6y7bvBvKNAxJkMrscQmo@t-dialin.net X-TOI-MSGID: b6c4498b-48e6-43aa-9a60-9abc18426847 X-detected-kernel: by monty-python.gnu.org: Linux 2.6 (newer, 3) Cc: Frans de Boer , bug-bash@gnu.org, chet@case.edu Subject: Re: Comparison failure X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 19 Jan 2008 10:03:22 -0000 Chet Ramey wrote: > Dave Rutherford wrote: > >> Now, "[[" isn't very well documented, so I tend not to use it, > > I'm always interested in suggestions for improving the bash documentation. > Can you tell me what's unclear about the existing description of > `[['? > > Chet > The documentation is complete. What some people always seem to forget is, that it's a reference, not a tutorial. You can't start to learn from the documentation. IMHO the job of the Bash documentation is to tell that "[[ ]]" exists, its working prionciple, and its differences to "[". But its job is not to tell *why* it exists. So, if the Bash documentation (mainly talking about the manpage here) is intended to be used as a reference, then it's definitely complete. When you know what you're searching for, you find it within a minute in 95% of the cases. J. From MAILER-DAEMON Sun Jan 20 18:14:02 2008 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1JGjMY-0001Oh-Nj for mharc-bug-bash@gnu.org; Sun, 20 Jan 2008 18:14:02 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JGjMX-0001La-Ak for bug-bash@gnu.org; Sun, 20 Jan 2008 18:14:01 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JGjMW-0001KZ-Pt for bug-bash@gnu.org; Sun, 20 Jan 2008 18:14:01 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JGjMW-0001KL-Me for bug-bash@gnu.org; Sun, 20 Jan 2008 18:14:00 -0500 Received: from mpv3.tis.cwru.edu ([129.22.105.35]) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_3DES_EDE_CBC_SHA1:24) (Exim 4.60) (envelope-from ) id 1JGjMW-0005W6-Fm for bug-bash@gnu.org; Sun, 20 Jan 2008 18:14:00 -0500 Received: from mpv5.TIS.cwru.edu (mpv5.TIS.CWRU.Edu [129.22.105.51]) by mpv3.TIS.cwru.edu (MOS 3.8.6-GA) with ESMTP id CBM38414; Sun, 20 Jan 2008 18:13:05 -0500 (EST) Received: from z4.local ([71.31.151.218]) by mpv5.TIS.cwru.edu (MOS 3.8.6-GA) with ESMTP id DTB42495 (AUTH cpr); Sun, 20 Jan 2008 18:13:03 -0500 (EST) Message-ID: <4793D57D.6040709@case.edu> Date: Sun, 20 Jan 2008 18:13:01 -0500 From: Chet Ramey Organization: ITS, Case Western Reserve University User-Agent: Thunderbird 2.0.0.9 (Macintosh/20071031) MIME-Version: 1.0 To: Andres Sajo References: <278507.47463.qm@web51410.mail.re2.yahoo.com> In-Reply-To: <278507.47463.qm@web51410.mail.re2.yahoo.com> X-Enigmail-Version: 0.95.6 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Junkmail-Status: score=10/49, host=mpv3.cwru.edu X-Junkmail-SD-Raw: score=unknown, refid=str=0001.0A090208.4793D581.0050,ss=1,fgs=0, ip=71.31.151.218, so=2007-10-30 19:00:17, dmn=5.4.3/2007-11-16 X-Junkmail-IWF: false X-detected-kernel: by monty-python.gnu.org: Genre and OS details not recognized. Cc: bug-bash@gnu.org, bash@packages.debian.org, chet@case.edu Subject: Re: "Bad substitution error" is not "well" reported, when invoking and array. X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: chet.ramey@case.edu List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 20 Jan 2008 23:14:01 -0000 Andres Sajo wrote: > Bash Version: 3.2 > Patch Level: 25 > Release Status: release > > Description: > "Bad substitution error" is not "well" reported, when invoking > and array: > VAR='([0]=first [1]=second)' > ${VAR[0] } works, but ${ VAR[0]} dosen't > Bash correctly flags the latter as an error, and allows the former as an extension for flexibility. Chet -- ``The lyf so short, the craft so long to lerne.'' - Chaucer Live Strong. No day but today. Chet Ramey, ITS, CWRU chet@case.edu http://cnswww.cns.cwru.edu/~chet/ From MAILER-DAEMON Wed Jan 23 08:54:08 2008 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1JHg3M-0000zp-8Y for mharc-bug-bash@gnu.org; Wed, 23 Jan 2008 08:54:08 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JHg3K-0000xA-CC for bug-bash@gnu.org; Wed, 23 Jan 2008 08:54:06 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JHg3J-0000wJ-O6 for bug-bash@gnu.org; Wed, 23 Jan 2008 08:54:06 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JHg3J-0000wD-LM for bug-bash@gnu.org; Wed, 23 Jan 2008 08:54:05 -0500 Received: from mpadmx-2.mpa-garching.mpg.de ([130.183.82.42]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JHg3J-0001DF-8T for bug-bash@gnu.org; Wed, 23 Jan 2008 08:54:05 -0500 Received: from [130.183.84.121] (nco-1.MPA-Garching.MPG.DE [130.183.84.121]) by mpadmx-2.MPA-Garching.MPG.DE (8.13.7/8.13.3) with ESMTP id m0NDrg45013686; Wed, 23 Jan 2008 14:53:42 +0100 Message-ID: <479746E6.7050000@MPA-Garching.MPG.DE> Date: Wed, 23 Jan 2008 14:53:42 +0100 From: Heinz-Ado Arnolds User-Agent: Thunderbird 1.5.0.13 (X11/20070809) MIME-Version: 1.0 To: bug-bash@gnu.org Content-Type: multipart/mixed; boundary="------------020401070204010702010205" X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.0 (mpadmx-2.MPA-Garching.MPG.DE [130.183.82.42]); Wed, 23 Jan 2008 14:53:42 +0100 (CET) X-detected-kernel: by monty-python.gnu.org: Linux 2.6 (newer, 1) Subject: Installation problem with info file when using separate object dir during building X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Jan 2008 13:54:06 -0000 This is a multi-part message in MIME format. --------------020401070204010702010205 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit 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/share/locale' -DPACKAGE='bash' -DSHELL -DHAVE_CONFIG_H -I. -I/tmp/S/bash-3.2 -I/tmp/S/bash-3.2/include -I/tmp/S/bash-3.2/lib -g -O2 uname output: Linux xxxxx 2.6.23.1 #1 SMP PREEMPT Tue Oct 16 16:47:14 CEST 2007 i686 GNU/Linux Machine Type: i686-pc-linux-gnu Bash Version: 3.2 Patch Level: 33 Release Status: release Description: When using a seperate object directory during build (e.g. O) the info file bash.info is built and written to O/doc/bash.info: bash.info: bashref.info ${SHELL} ${INFOPOST} < $(srcdir)/bashref.info > $@ ; The installation procedure tries to install it from $(srcdir) and will not find it there: -$(INSTALL_DATA) $(srcdir)/bash.info $(DESTDIR)$(infodir)/bash.info Repeat-By: make Fix: see attachment --------------020401070204010702010205 Content-Type: text/plain; name="bash32-arnolds" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="bash32-arnolds" *** ../bash-3.2-patched/doc/Makefile.in Tue Jul 27 14:57:48 2004 --- ./doc/Makefile.in Wed Jan 23 14:26:02 2008 *************** *** 225,231 **** -$(INSTALL_DATA) $(srcdir)/bashbug.1 $(DESTDIR)$(man1dir)/bashbug${man1ext} # uncomment the next line to install the builtins man page # -$(INSTALL_DATA) $(srcdir)/builtins.1 $(DESTDIR)$(man1dir)/bash_builtins${man1ext} ! -$(INSTALL_DATA) $(srcdir)/bash.info $(DESTDIR)$(infodir)/bash.info # run install-info if it is present to update the info directory if $(SHELL) -c 'install-info --version' >/dev/null 2>&1; then \ install-info --dir-file=$(DESTDIR)$(infodir)/dir $(DESTDIR)$(infodir)/bash.info; \ --- 225,231 ---- -$(INSTALL_DATA) $(srcdir)/bashbug.1 $(DESTDIR)$(man1dir)/bashbug${man1ext} # uncomment the next line to install the builtins man page # -$(INSTALL_DATA) $(srcdir)/builtins.1 $(DESTDIR)$(man1dir)/bash_builtins${man1ext} ! -$(INSTALL_DATA) bash.info $(DESTDIR)$(infodir)/bash.info # run install-info if it is present to update the info directory if $(SHELL) -c 'install-info --version' >/dev/null 2>&1; then \ install-info --dir-file=$(DESTDIR)$(infodir)/dir $(DESTDIR)$(infodir)/bash.info; \ --------------020401070204010702010205-- From MAILER-DAEMON Wed Jan 23 10:54:39 2008 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1JHhvz-000121-GP for mharc-bug-bash@gnu.org; Wed, 23 Jan 2008 10:54:39 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JHcLS-0008Dw-GR for bug-bash@gnu.org; Wed, 23 Jan 2008 04:56:34 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JHcLK-0008BF-VL for bug-bash@gnu.org; Wed, 23 Jan 2008 04:56:32 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JHcLK-0008B3-5R for bug-bash@gnu.org; Wed, 23 Jan 2008 04:56:26 -0500 Received: from trinity.supernews.net ([216.168.1.22]) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1JHcLJ-0004kM-Le for bug-bash@gnu.org; Wed, 23 Jan 2008 04:56:25 -0500 Received: from koch.zen.co.uk ([212.23.3.20]:40674) by trinity.supernews.net with esmtps (TLSv1:AES256-SHA:256) (Exim 4.69 (FreeBSD)) (envelope-from ) id 1JHcKw-000MM4-12 for gnu-bash-bug@moderators.isc.org; Wed, 23 Jan 2008 09:56:02 +0000 Received: from reader02.news.zen.co.uk ([212.23.3.131]) by koch.zen.co.uk with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA:32) (Exim 4.50) id 1JHcKi-0006Pp-GL for gnu-bash-bug@moderators.isc.org; Wed, 23 Jan 2008 09:55:49 +0000 Received: from news by reader02.news.zen.co.uk with local (Exim 4.50) id 1JHcIn-0005bH-Ju for gnu-bash-bug@moderators.isc.org; Wed, 23 Jan 2008 09:53:49 +0000 To: gnu-bash-bug@moderators.isc.org Newsgroups: gnu.bash.bug From: dog User-Agent: slrn/0.9.8.1 (Darwin) Date: 23 Jan 2008 09:53:49 GMT Lines: 23 Message-ID: <47970ead$0$13927$fa0fcedb@news.zen.co.uk> Organization: Zen Internet NNTP-Posting-Host: 6a1584c7.news.zen.co.uk X-Trace: DXC=TgQk]KoNGOBTHJl0YRfECGYjZGX^207PK` X-detected-kernel: by monty-python.gnu.org: FreeBSD 6.x (1) X-Mailman-Approved-At: Wed, 23 Jan 2008 10:54:37 -0500 Cc: Subject: readline escaping problems X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Jan 2008 09:56:36 -0000 i have an install of a recent version of readline (5.2.007) / bash (3.2.25) which is causing problems with horizontal scrolling positioning because of escape sequences in my PS1 prompt. i have read the faq, but the fix suggested does not work for me. here is my PS1 prompt: PS1="\n\e[39m\u\e[00m \e[00;34m[\w]\e[00m " according to the faq this should be encoded as: PS1="\n\[\e[39m\]\u@\h\[\e[00m\] \[\e[00;34m\][\w]\[\e[00m\] " however this does not work either, with horizontal-scroll-mode on or off - positioning is still screwed up. also note that the first prompt works perfectly well with readline 4.2a / bash 2.05a, but *the second one does not*. any suggestions? -- dog From MAILER-DAEMON Wed Jan 23 14:16:15 2008 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1JHl55-0007ic-B3 for mharc-bug-bash@gnu.org; Wed, 23 Jan 2008 14:16:15 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JHl53-0007g4-EE for bug-bash@gnu.org; Wed, 23 Jan 2008 14:16:13 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JHl51-0007dD-Vf for bug-bash@gnu.org; Wed, 23 Jan 2008 14:16:13 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JHl51-0007cy-PE for bug-bash@gnu.org; Wed, 23 Jan 2008 14:16:11 -0500 Received: from mpv2.tis.cwru.edu ([129.22.105.37]) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_3DES_EDE_CBC_SHA1:24) (Exim 4.60) (envelope-from ) id 1JHl51-0008LP-OY for bug-bash@gnu.org; Wed, 23 Jan 2008 14:16:11 -0500 Received: from mpv6.TIS.cwru.edu (mpv6.TIS.CWRU.Edu [129.22.104.221]) by mpv2.tis.cwru.edu (MOS 3.8.6-GA) with ESMTP id CQD66023; Wed, 23 Jan 2008 14:11:01 -0500 (EST) Received: from caleb.ins.cwru.edu (caleb.INS.CWRU.Edu [129.22.8.211]) by mpv6.TIS.cwru.edu (MOS 3.8.6-GA) with SMTP id DUN47927; Wed, 23 Jan 2008 14:10:40 -0500 (EST) Date: Wed, 23 Jan 2008 14:07:50 -0500 From: Chet Ramey Sender: Chet Ramey To: dog@dev.null References: <47970ead$0$13927$fa0fcedb@news.zen.co.uk> In-Reply-To: Message from dog@dev.null of Wed, 23 Jan 2008 09:53:49 +0000 (GMT) (id <47970ead$0$13927$fa0fcedb@news.zen.co.uk>) Message-ID: <080123190750.AA26306.SM@caleb.ins.cwru.edu> Read-Receipt-To: chet.ramey@case.edu MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Junkmail-Status: score=10/49, host=mpv2.tis.cwru.edu X-Junkmail-SD-Raw: score=unknown, refid=str=0001.0A090207.47979273.0087,ss=1,fgs=0, ip=129.22.104.221, so=2007-10-30 19:00:17, dmn=5.4.3/2007-11-16 X-Junkmail-IWF: false X-detected-kernel: by monty-python.gnu.org: Genre and OS details not recognized. Cc: bug-bash@gnu.org, chet@case.edu Subject: Re: readline escaping problems X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: chet.ramey@case.edu List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Jan 2008 19:16:13 -0000 > i have an install of a recent version of readline (5.2.007) / bash (3.2.25) > which is causing problems with horizontal scrolling positioning because of > escape sequences in my PS1 prompt. It looks like bash32-028 contains a fix for this problem. In the future, you might consider providing a valid email address for responses. Chet -- ``The lyf so short, the craft so long to lerne.'' - Chaucer Live Strong. Chet Ramey, ITS, CWRU chet@case.edu http://tiswww.tis.case.edu/~chet/ From MAILER-DAEMON Thu Jan 24 01:25:52 2008 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1JHvX6-0008GQ-My for mharc-bug-bash@gnu.org; Thu, 24 Jan 2008 01:25:52 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JHijG-0006sV-89 for bug-bash@gnu.org; Wed, 23 Jan 2008 11:45:34 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JHijB-0006hW-2s for bug-bash@gnu.org; Wed, 23 Jan 2008 11:45:33 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JHijA-0006hA-TI for bug-bash@gnu.org; Wed, 23 Jan 2008 11:45:28 -0500 Received: from mail.macqel.be ([194.78.208.39]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JHijA-0006N3-Fh for bug-bash@gnu.org; Wed, 23 Jan 2008 11:45:28 -0500 Received: by mail.macqel.be (Postfix, from userid 500) id 6DD5EB87A2; Wed, 23 Jan 2008 17:45:25 +0100 (CET) Date: Wed, 23 Jan 2008 17:45:25 +0100 From: Philippe De Muyter To: bug-bash@gnu.org Message-ID: <20080123164525.GA8576@ingate.macqel> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.4.1i X-detected-kernel: by monty-python.gnu.org: Linux 2.4-2.6 X-Mailman-Approved-At: Thu, 24 Jan 2008 01:25:51 -0500 Subject: bash's own getcwd reads uninitialized/nonexistent memory X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Jan 2008 16:45:34 -0000 Configuration Information [Automatically generated, do not change]: Machine: powerpc OS: linux-gnuspe Compiler: powerpc-linuxspe-gcc Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='powerpc' -DCONF_OSTYPE='linux-gnuspe' -DCONF_MACHTYPE='powerpc-unknown-linux-gnuspe' -DCONF_VENDOR='unknown' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash' -DSHELL -DHAVE_CONFIG_H -I. -I/archives/meip/devtools/cross-build/src/bash-3.2 -I/archives/meip/devtools/cross-build/src/bash-3.2/include -I/archives/meip/devtools/cross-build/src/bash-3.2/lib -g -O2 uname output: Linux (none) 2.6.19 #17 Thu Dec 7 11:20:51 CET 2006 ppc GNU/Linux Machine Type: powerpc-unknown-linux-gnuspe Bash Version: 3.2 Patch Level: 33 Release Status: release Description: bash's own getcwd reads uninitialzed/non-existent memory when called as getcwd(0, 4096); That made it non-responding when started with linux boot params as `init=/bin/sh'. Repeat-By: Compile bash with BROKEN_GETCWD Fix: here is a patch : Summary : `len' is the real length of the found path `size' is the size of the requested buffer (4096 above) the current code allocates max(len, size) and then COPIES MAX(len, size) which is plain wrong; it should only copy len : that's what the new code does. : it allocates max(len, size) but copies len. diff -rup -U 10 cross-build/src/bash-3.2/lib/sh/getcwd.c cross-build/src/bash-3.2-phdm/lib/sh/getcwd.c --- cross-build/src/bash-3.2/lib/sh/getcwd.c 2004-07-21 23:15:19.000000000 +0200 +++ cross-build/src/bash-3.2-fixed/lib/sh/getcwd.c 2008-01-22 15:32:51.000000000 +0100 @@ -246,23 +246,23 @@ getcwd (buf, size) if (pathp == &path[sizeof(path) - 1]) *--pathp = '/'; if (dotlist != dots) free ((PTR_T) dotlist); { size_t len = pathbuf + pathsize - pathp; if (buf == NULL) { - if (len < (size_t) size) - len = size; - buf = (char *) malloc (len); + if ((size_t) size < len) + size = len; + buf = (char *) malloc (size); if (buf == NULL) goto lose2; } else if ((size_t) size < len) { errno = ERANGE; goto lose2; } (void) memcpy((PTR_T) buf, (PTR_T) pathp, len); } From MAILER-DAEMON Thu Jan 24 04:12:48 2008 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1JHy8e-0001z5-7G for mharc-bug-bash@gnu.org; Thu, 24 Jan 2008 04:12:48 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JHy8a-0001yH-Bw for bug-bash@gnu.org; Thu, 24 Jan 2008 04:12:44 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JHy8X-0001wt-BF for bug-bash@gnu.org; Thu, 24 Jan 2008 04:12:43 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JHy8X-0001wW-3t for bug-bash@gnu.org; Thu, 24 Jan 2008 04:12:41 -0500 Received: from smtp.salomon.at ([193.186.16.13]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JHy8W-0001Wl-Of for bug-bash@gnu.org; Thu, 24 Jan 2008 04:12:41 -0500 Received: from servex01.wamas.com (servex01.salomon.at [172.28.2.2]) by smtp.salomon.at (8.12.10/8.12.10) with ESMTP id m0O9CJ0i026789; Thu, 24 Jan 2008 10:12:20 +0100 (MET) Received: from [172.28.8.78] ([172.28.8.78]) by servex01.wamas.com with Microsoft SMTPSVC(6.0.3790.3959); Thu, 24 Jan 2008 10:12:19 +0100 From: Michael Haubenwallner To: Philippe De Muyter In-Reply-To: <20080123164525.GA8576@ingate.macqel> References: <20080123164525.GA8576@ingate.macqel> Content-Type: text/plain Date: Thu, 24 Jan 2008 10:12:19 +0100 Message-Id: <1201165939.30746.5.camel@sapc154> Mime-Version: 1.0 X-Mailer: Evolution 2.10.3 Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 24 Jan 2008 09:12:19.0725 (UTC) FILETIME=[38C7BBD0:01C85E69] X-Spam-Info: -0.73 () ALL_TRUSTED,BAYES_50,SPF_NEUTRAL X-Scanned-By: MIMEDefang 2.54 on 172.28.2.13 X-detected-kernel: by monty-python.gnu.org: HP-UX 11.00-11.11 Cc: bug-bash@gnu.org Subject: Re: bash's own getcwd reads uninitialized/nonexistent memory X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Jan 2008 09:12:44 -0000 On Wed, 2008-01-23 at 17:45 +0100, Philippe De Muyter wrote: > here is a patch : LOL - this is a very similar patch as http://lists.gnu.org/archive/html/bug-bash/2007-12/msg00084.html /haubi/ -- Michael Haubenwallner Gentoo on a different level From MAILER-DAEMON Thu Jan 24 05:36:38 2008 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1JHzRl-0005vq-Up for mharc-bug-bash@gnu.org; Thu, 24 Jan 2008 05:36:37 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JHzRj-0005uH-JZ for bug-bash@gnu.org; Thu, 24 Jan 2008 05:36:35 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JHzRi-0005t9-2b for bug-bash@gnu.org; Thu, 24 Jan 2008 05:36:34 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JHzRh-0005sz-TP for bug-bash@gnu.org; Thu, 24 Jan 2008 05:36:33 -0500 Received: from mail.macqel.be ([194.78.208.39]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JHzRh-0003V9-Ft for bug-bash@gnu.org; Thu, 24 Jan 2008 05:36:33 -0500 Received: by mail.macqel.be (Postfix, from userid 500) id 25C03BAAF3; Thu, 24 Jan 2008 11:36:32 +0100 (CET) Date: Thu, 24 Jan 2008 11:36:31 +0100 From: Philippe De Muyter To: Michael Haubenwallner Message-ID: <20080124103631.GA26179@ingate.macqel> References: <20080123164525.GA8576@ingate.macqel> <1201165939.30746.5.camel@sapc154> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1201165939.30746.5.camel@sapc154> User-Agent: Mutt/1.4.1i X-detected-kernel: by monty-python.gnu.org: Linux 2.4-2.6 Cc: bug-bash@gnu.org Subject: Re: bash's own getcwd reads uninitialized/nonexistent memory X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Jan 2008 10:36:36 -0000 Hello Michael, On Thu, Jan 24, 2008 at 10:12:19AM +0100, Michael Haubenwallner wrote: > On Wed, 2008-01-23 at 17:45 +0100, Philippe De Muyter wrote: > > > here is a patch : > > LOL - this is a very similar patch as > http://lists.gnu.org/archive/html/bug-bash/2007-12/msg00084.html Let's hope one of these patches becomes official now. Best regards Philippe From MAILER-DAEMON Sun Jan 27 09:03:23 2008 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1JJ86V-0004z3-Fq for mharc-bug-bash@gnu.org; Sun, 27 Jan 2008 09:03:23 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JJ86U-0004ys-8O for bug-bash@gnu.org; Sun, 27 Jan 2008 09:03:22 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JJ86S-0004xi-JO for bug-bash@gnu.org; Sun, 27 Jan 2008 09:03:20 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JJ86S-0004xZ-Di for bug-bash@gnu.org; Sun, 27 Jan 2008 09:03:20 -0500 Received: from ocean.hostingzoom.com ([209.51.135.2]) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1JJ86S-0003rH-34 for bug-bash@gnu.org; Sun, 27 Jan 2008 09:03:20 -0500 Received: from [127.0.0.1] (port=38296 helo=www.e-arroyo.net) by ocean.hostingzoom.com with esmtpa (Exim 4.68) (envelope-from ) id 1JJ86F-00032M-PO for bug-bash@gnu.org; Sun, 27 Jan 2008 08:03:07 -0600 Received: from 75.37.15.205 ([75.37.15.205]) (SquirrelMail authenticated user abi@e-arroyo.net) by www.e-arroyo.net with HTTP; Sun, 27 Jan 2008 08:03:07 -0600 (CST) Message-ID: <20129.75.37.15.205.1201442587.squirrel@www.e-arroyo.net> Date: Sun, 27 Jan 2008 08:03:07 -0600 (CST) From: abi@e-arroyo.net To: bug-bash@gnu.org User-Agent: SquirrelMail/1.4.9a MIME-Version: 1.0 Content-Type: text/plain;charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Priority: 3 (Normal) Importance: Normal X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - ocean.hostingzoom.com X-AntiAbuse: Original Domain - gnu.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - e-arroyo.net X-detected-kernel: by monty-python.gnu.org: Linux 2.6? (barebone, rare!) Subject: Exit application with two function calls X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 27 Jan 2008 14:03:22 -0000 Hi, I am working on a script and ran into an unusual program. Consider the following script which I called how.sh. ===== #!/bin/bash error () { echo -e "\n\terror: ${*}\n" exit; # kill $$ } check_file () { input="$*" if [ -e $input ]; then echo "$input" else error "invalid directory: $input" fi } chkFile="`check_file $1`" echo $chkFile echo "don't print" ===== When I run the command above I get this output: # ./how.sh /asdf error: invalid directory: /asdf don't print The intention of the script is not to print the second echo statement. I've tried changing the first echo with exec and eval and also adding these commands before the call to check_file in the variable assignment, but to no avail. The error() function is suppose to print the error, and completely exit the script. One alternative is to use the kill statement, however this route does not print the error message and prints the "termination" message. How can the problem I'm having exiting the application be solved? I'd like to resulting code to be as clean as possible, and make all error messages go through the error() function. Thanks in advance. Abi From MAILER-DAEMON Sun Jan 27 11:20:05 2008 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1JJAEm-0006N6-UK for mharc-bug-bash@gnu.org; Sun, 27 Jan 2008 11:20:04 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JJAEk-0006MH-TZ for bug-bash@gnu.org; Sun, 27 Jan 2008 11:20:02 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JJAEk-0006Lm-BE for bug-bash@gnu.org; Sun, 27 Jan 2008 11:20:02 -0500 Received: from m1.goneo.de ([82.100.220.80]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JJAEk-0008Rj-2N for bug-bash@gnu.org; Sun, 27 Jan 2008 11:20:02 -0500 Received: from localhost (localhost.goneo.de [127.0.0.1]) by scan.goneo.de (Postfix) with ESMTP id B30C464FC75; Sun, 27 Jan 2008 17:19:59 +0100 (CET) X-Virus-Scanned: amavisd-new at goneo.de X-Spam-Score: -1.568 Received: from m1.goneo.de ([127.0.0.1]) by localhost (m1.goneo.de [127.0.0.1]) (amavisd-new, port 10024) with LMTP id uygEO8xRisJC; Sun, 27 Jan 2008 17:19:46 +0100 (CET) Received: from [192.168.178.2] (d155002.adsl.hansenet.de [80.171.155.2]) by m1-smtp.goneo.de (Postfix) with ESMTP id 4A55B64FC5D; Sun, 27 Jan 2008 17:19:45 +0100 (CET) Message-ID: <479CAF21.10605@sudrala.de> Date: Sun, 27 Jan 2008 17:19:45 +0100 From: Bernd Eggink User-Agent: Thunderbird 2.0.0.9 (X11/20071031) MIME-Version: 1.0 To: abi@e-arroyo.net References: <20129.75.37.15.205.1201442587.squirrel@www.e-arroyo.net> In-Reply-To: <20129.75.37.15.205.1201442587.squirrel@www.e-arroyo.net> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-detected-kernel: by monty-python.gnu.org: FreeBSD 6.x (1) Cc: bug-bash@gnu.org Subject: Re: Exit application with two function calls X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 27 Jan 2008 16:20:04 -0000 abi@e-arroyo.net schrieb: > Hi, > > I am working on a script and ran into an unusual program. Consider the > following script which I called how.sh. > > ===== > > #!/bin/bash > > error () { > > echo -e "\n\terror: ${*}\n" > exit; > > # kill $$ > > } > > check_file () { > > input="$*" > > if [ -e $input ]; then > echo "$input" > else > error "invalid directory: $input" > fi > > } > > > chkFile="`check_file $1`" > echo $chkFile > echo "don't print" > > ===== > > When I run the command above I get this output: > > # ./how.sh /asdf > error: invalid directory: /asdf > don't print The reason is that `check_file` is executed in a subshell, so 'exit' just leaves the subshell, not the script itself. The command substitution is unnecessary anyway, as the result (if any) will simply be $1 itself. Thus, if you replace the main part by check_file $1 echo $1 it should work as expected. Regards, Bernd -- Bernd Eggink monoped@sudrala.de http://sudrala.de From MAILER-DAEMON Sun Jan 27 11:57:52 2008 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1JJApL-0005ue-W8 for mharc-bug-bash@gnu.org; Sun, 27 Jan 2008 11:57:52 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JJApI-0005sH-Ue for bug-bash@gnu.org; Sun, 27 Jan 2008 11:57:49 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JJApG-0005rK-G7 for bug-bash@gnu.org; Sun, 27 Jan 2008 11:57:47 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JJApG-0005rH-9d for bug-bash@gnu.org; Sun, 27 Jan 2008 11:57:46 -0500 Received: from ns.suse.de ([195.135.220.2] helo=mx1.suse.de) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1JJApF-0000e8-QU for bug-bash@gnu.org; Sun, 27 Jan 2008 11:57:46 -0500 Received: from Relay2.suse.de (mail2.suse.de [195.135.221.8]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.suse.de (Postfix) with ESMTP id 4766026826; Sun, 27 Jan 2008 17:57:42 +0100 (CET) From: Andreas Schwab To: abi@e-arroyo.net References: <20129.75.37.15.205.1201442587.squirrel@www.e-arroyo.net> X-Yow: I just heard the SEVENTIES were over!! And I was just getting in touch with my LEISURE SUIT!! Date: Sun, 27 Jan 2008 17:57:41 +0100 In-Reply-To: <20129.75.37.15.205.1201442587.squirrel@www.e-arroyo.net> (abi@e-arroyo.net's message of "Sun\, 27 Jan 2008 08\:03\:07 -0600 \(CST\)") Message-ID: User-Agent: Gnus/5.110006 (No Gnus v0.6) Emacs/22.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable X-detected-kernel: by monty-python.gnu.org: Linux 2.4-2.6 Cc: bug-bash@gnu.org Subject: Re: Exit application with two function calls X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 27 Jan 2008 16:57:49 -0000 abi@e-arroyo.net writes: > =3D=3D=3D=3D=3D > > #!/bin/bash > > error () { > > echo -e "\n\terror: ${*}\n" > exit; Replace that with "exit 1". You can use any other non-zero exit code. > # kill $$ > > } > > check_file () { > > input=3D"$*" > > if [ -e $input ]; then This will fail if the argument contains a space. You need to properly quote the variable, as you did below. > echo "$input" > else > error "invalid directory: $input" > fi > > } > > > chkFile=3D"`check_file $1`" Replace that with chkFile=3D`check_file "$1"` || exit Andreas. --=20 Andreas Schwab, SuSE Labs, schwab@suse.de SuSE Linux Products GmbH, Maxfeldstra=DFe 5, 90409 N=FCrnberg, Germany PGP key fingerprint =3D 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED= 5 "And now for something completely different." From MAILER-DAEMON Sun Jan 27 17:05:03 2008 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1JJFcd-0002SC-3H for mharc-bug-bash@gnu.org; Sun, 27 Jan 2008 17:05:03 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JJFcb-0002Rn-29 for bug-bash@gnu.org; Sun, 27 Jan 2008 17:05:01 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JJFcY-0002Rb-F2 for bug-bash@gnu.org; Sun, 27 Jan 2008 17:04:59 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JJFcY-0002RY-B9 for bug-bash@gnu.org; Sun, 27 Jan 2008 17:04:58 -0500 Received: from ocean.hostingzoom.com ([209.51.135.2]) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1JJFcY-0006NQ-0Z for bug-bash@gnu.org; Sun, 27 Jan 2008 17:04:58 -0500 Received: from [127.0.0.1] (port=46702 helo=www.e-arroyo.net) by ocean.hostingzoom.com with esmtpa (Exim 4.68) (envelope-from ) id 1JJFcP-0005IQ-In; Sun, 27 Jan 2008 16:04:49 -0600 Received: from 76.203.50.222 ([76.203.50.222]) (SquirrelMail authenticated user abi@e-arroyo.net) by www.e-arroyo.net with HTTP; Sun, 27 Jan 2008 16:04:49 -0600 (CST) Message-ID: <20643.76.203.50.222.1201471489.squirrel@www.e-arroyo.net> In-Reply-To: References: <20129.75.37.15.205.1201442587.squirrel@www.e-arroyo.net> Date: Sun, 27 Jan 2008 16:04:49 -0600 (CST) From: abi@e-arroyo.net To: "Andreas Schwab" User-Agent: SquirrelMail/1.4.9a MIME-Version: 1.0 Content-Type: text/plain;charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Priority: 3 (Normal) Importance: Normal X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - ocean.hostingzoom.com X-AntiAbuse: Original Domain - gnu.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - e-arroyo.net X-detected-kernel: by monty-python.gnu.org: Linux 2.6? (barebone, rare!) Cc: bug-bash@gnu.org, abi@e-arroyo.net Subject: Re: Exit application with two function calls X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 27 Jan 2008 22:05:01 -0000 > abi@e-arroyo.net writes: > >> ===== >> >> #!/bin/bash >> >> error () { >> >> echo -e "\n\terror: ${*}\n" >> exit; > > Replace that with "exit 1". You can use any other non-zero exit code. > >> # kill $$ >> >> } >> >> check_file () { >> >> input="$*" >> >> if [ -e $input ]; then > > This will fail if the argument contains a space. You need to properly > quote the variable, as you did below. > >> echo "$input" >> else >> error "invalid directory: $input" >> fi >> >> } >> >> >> chkFile="`check_file $1`" > > Replace that with > > chkFile=`check_file "$1"` || exit > > Andreas. > > -- > Andreas Schwab, SuSE Labs, schwab@suse.de > SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany > PGP key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 > "And now for something completely different." > Thanks for the response! The OR statement is an excellent solution. From MAILER-DAEMON Sun Jan 27 17:11:47 2008 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1JJFj8-00060s-Vo for mharc-bug-bash@gnu.org; Sun, 27 Jan 2008 17:11:47 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JJFj6-0005xh-Ix for bug-bash@gnu.org; Sun, 27 Jan 2008 17:11:44 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JJFj5-0005vO-2G for bug-bash@gnu.org; Sun, 27 Jan 2008 17:11:44 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JJFj4-0005v5-NF for bug-bash@gnu.org; Sun, 27 Jan 2008 17:11:42 -0500 Received: from ocean.hostingzoom.com ([209.51.135.2]) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1JJFj4-0008JJ-DD for bug-bash@gnu.org; Sun, 27 Jan 2008 17:11:42 -0500 Received: from [127.0.0.1] (port=33237 helo=www.e-arroyo.net) by ocean.hostingzoom.com with esmtpa (Exim 4.68) (envelope-from ) id 1JJFiw-0002fh-Ej; Sun, 27 Jan 2008 16:11:34 -0600 Received: from 76.203.50.222 ([76.203.50.222]) (SquirrelMail authenticated user abi@e-arroyo.net) by www.e-arroyo.net with HTTP; Sun, 27 Jan 2008 16:11:34 -0600 (CST) Message-ID: <20727.76.203.50.222.1201471894.squirrel@www.e-arroyo.net> In-Reply-To: <479CAF21.10605@sudrala.de> References: <20129.75.37.15.205.1201442587.squirrel@www.e-arroyo.net> <479CAF21.10605@sudrala.de> Date: Sun, 27 Jan 2008 16:11:34 -0600 (CST) From: abi@e-arroyo.net To: "Bernd Eggink" User-Agent: SquirrelMail/1.4.9a MIME-Version: 1.0 Content-Type: text/plain;charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Priority: 3 (Normal) Importance: Normal X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - ocean.hostingzoom.com X-AntiAbuse: Original Domain - gnu.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - e-arroyo.net X-detected-kernel: by monty-python.gnu.org: Linux 2.6? (barebone, rare!) Cc: bug-bash@gnu.org, abi@e-arroyo.net Subject: Re: Exit application with two function calls X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 27 Jan 2008 22:11:45 -0000 > abi@e-arroyo.net schrieb: >> Hi, >> >> I am working on a script and ran into an unusual program. Consider the >> following script which I called how.sh. >> >> ===== >> >> #!/bin/bash >> >> error () { >> >> echo -e "\n\terror: ${*}\n" >> exit; >> >> # kill $$ >> >> } >> >> check_file () { >> >> input="$*" >> >> if [ -e $input ]; then >> echo "$input" >> else >> error "invalid directory: $input" >> fi >> >> } >> >> >> chkFile="`check_file $1`" >> echo $chkFile >> echo "don't print" >> >> ===== >> >> When I run the command above I get this output: >> >> # ./how.sh /asdf >> error: invalid directory: /asdf >> don't print > > The reason is that `check_file` is executed in a subshell, so 'exit' > just leaves the subshell, not the script itself. > > The command substitution is unnecessary anyway, as the result (if any) > will simply be $1 itself. Thus, if you replace the main part by > > check_file $1 > echo $1 > > it should work as expected. > > Regards, > Bernd > > -- > Bernd Eggink > monoped@sudrala.de > http://sudrala.de > Thanks for the reply! While you are correct, this isn't exactly the intended functionality. In the end I'd like $chkFile variable to contain the path or exit the script printing the error message. This is probably unclear due to the fact that only a snippet is posted and not the entire script. From MAILER-DAEMON Sun Jan 27 19:27:29 2008 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1JJHqT-0007nf-Lc for mharc-bug-bash@gnu.org; Sun, 27 Jan 2008 19:27:29 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JJHqS-0007nX-5z for bug-bash@gnu.org; Sun, 27 Jan 2008 19:27:28 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JJHqQ-0007nL-Il for bug-bash@gnu.org; Sun, 27 Jan 2008 19:27:26 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JJHqQ-0007nI-Ga for bug-bash@gnu.org; Sun, 27 Jan 2008 19:27:26 -0500 Received: from ishtar.tlinx.org ([64.81.245.74]) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1JJHqQ-0007Me-02 for bug-bash@gnu.org; Sun, 27 Jan 2008 19:27:26 -0500 Received: from [192.168.3.11] (Athena [192.168.3.11]) by ishtar.tlinx.org (8.13.3/8.12.10/SuSE Linux 0.7) with ESMTP id m0S0PaET000847; Sun, 27 Jan 2008 16:25:36 -0800 Message-ID: <479D2100.1050106@tlinx.org> Date: Sun, 27 Jan 2008 16:25:36 -0800 From: Linda Walsh User-Agent: Thunderbird 2.0.0.9 (Windows/20071031) MIME-Version: 1.0 To: abi@e-arroyo.net References: <20129.75.37.15.205.1201442587.squirrel@www.e-arroyo.net> In-Reply-To: <20129.75.37.15.205.1201442587.squirrel@www.e-arroyo.net> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-detected-kernel: by monty-python.gnu.org: Linux 2.6 (newer, 2) Cc: bug-bash@gnu.org Subject: Re: Exit application with two function calls X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Jan 2008 00:27:28 -0000 In the spirit of there being more than one solution to every problem, I made the solution "more complicated" :-) in case you wanted to check more error conditions... I included some "Notes" about why I did some things they way I did, since it may not be immediately obvious. Some of them are probably "personal taste".... ------ #!/bin/bash -e # *1 Error () # *2 { # *3 echo -e "\n\terror: ${*}\n" return 2 } Check_file () { if [[ -d "$1" ]]; then echo "$1" # *4 else return Error "invalid directory: \"$1\""; fi return 0 } if [[ "$#" -ne 1 ]]; then echo "$0 called with wrong number of params" && exit 3 else chkFile=$(Check_file "$1") || { echo "do not print"; exit 4; } # *5 & *6 fi #--------------------------- # Notes: # *1 - using "-e" stops your script immediately on any error; useful # during debugging (maybe production if for yourself only); # Using "-ue" while slightly more work will also catch unexpectedly # empty shell-variables; to trivially catch undef vars where # you expect possiblity of undef'ed vars, use: ${maybeundef:-} # *2 - Capitalizing func names usually helps to not confuse function # names with system commands # *3 - if you want a blank line for readability after a function def, # just put the curly brace on the next line (slightly more readable # in my opinion, but personal pref # *4 - test with "-d" if you are expecting a directory # *5 - note -- quotes around param, "$1", in case there is a space # embedded in the argument # *6 - prefer construct "$(cmd) over `cmd`; avoides some quoting probs # or cockpit errors From MAILER-DAEMON Sun Jan 27 21:00:42 2008 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1JJJIg-0008UH-PR for mharc-bug-bash@gnu.org; Sun, 27 Jan 2008 21:00:42 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JJJIe-0008Rf-MS for bug-bash@gnu.org; Sun, 27 Jan 2008 21:00:40 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JJJIZ-0008N5-G8 for bug-bash@gnu.org; Sun, 27 Jan 2008 21:00:39 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JJJIZ-0008Mv-7M for bug-bash@gnu.org; Sun, 27 Jan 2008 21:00:35 -0500 Received: from ishtar.tlinx.org ([64.81.245.74]) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1JJJIY-0005pm-P5 for bug-bash@gnu.org; Sun, 27 Jan 2008 21:00:35 -0500 Received: from [192.168.3.11] (Athena [192.168.3.11]) by ishtar.tlinx.org (8.13.3/8.12.10/SuSE Linux 0.7) with ESMTP id m0S20Ww9001969 for ; Sun, 27 Jan 2008 18:00:32 -0800 Message-ID: <479D3740.6080406@tlinx.org> Date: Sun, 27 Jan 2008 18:00:32 -0800 From: Linda Walsh User-Agent: Thunderbird 2.0.0.9 (Windows/20071031) MIME-Version: 1.0 To: bug-bash@gnu.org Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-detected-kernel: by monty-python.gnu.org: Linux 2.6 (newer, 2) Subject: capturing sub-expressions? X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Jan 2008 02:00:41 -0000 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? If the full expression was in a shellvar "Options", I thought about using something like: ${Option//!(expr)} which I hoped would have "!(expr) match anything but my desired expression, and the double "/" would say allow it to match multiple times, but it appears the "!()" construct is limited to pathname expansion? Presuming that is true (limited to pathname expansion), is there anyway to do it on Shell vars? I keep confusing the path-matching regular expressions with string-matching expressions and keep getting disappointed when I'm re-reminded of the limitation...:-( Maybe an "RFE"?...(*sigh*) Linda From MAILER-DAEMON Sun Jan 27 21:03:59 2008 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1JJJLr-0000Tr-3x for mharc-bug-bash@gnu.org; Sun, 27 Jan 2008 21:03:59 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JJJLp-0000Sy-0x for bug-bash@gnu.org; Sun, 27 Jan 2008 21:03:57 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JJJLm-0000Rn-0O for bug-bash@gnu.org; Sun, 27 Jan 2008 21:03:56 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JJJLl-0000Rg-Pc for bug-bash@gnu.org; Sun, 27 Jan 2008 21:03:53 -0500 Received: from mpv2.tis.cwru.edu ([129.22.105.37]) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_3DES_EDE_CBC_SHA1:24) (Exim 4.60) (envelope-from ) id 1JJJLl-0006G4-DP for bug-bash@gnu.org; Sun, 27 Jan 2008 21:03:53 -0500 Received: from mpv6.TIS.cwru.edu (mpv6.TIS.CWRU.Edu [129.22.104.221]) by mpv2.tis.cwru.edu (MOS 3.8.6-GA) with ESMTP id CQF92109 for ; Sun, 27 Jan 2008 21:03:20 -0500 (EST) Received: from multivac.cwru.edu (multivac.its.CWRU.Edu [129.22.114.26]) by mpv6.TIS.cwru.edu (MOS 3.8.6-GA) with SMTP id DVZ20185 for ; Sun, 27 Jan 2008 21:03:20 -0500 (EST) Received: (qmail 25823 invoked by uid 500); 28 Jan 2008 02:03:42 -0000 To: Linda Walsh In-Reply-To: <479D2100.1050106@tlinx.org> (Linda Walsh's message of "Sun\, 27 Jan 2008 16\:25\:36 -0800") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1 (gnu/linux) References: <20129.75.37.15.205.1201442587.squirrel@www.e-arroyo.net> <479D2100.1050106@tlinx.org> From: prj@po.cwru.edu (Paul Jarc) Organization: What did you have in mind? A short, blunt, human pyramid? Mail-Copies-To: nobody Mail-Followup-To: Linda Walsh , abi@e-arroyo.net, bug-bash@gnu.org Date: Sun, 27 Jan 2008 21:03:16 -0500 Message-ID: Lines: 9 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Junkmail-Status: score=10/49, host=mpv2.tis.cwru.edu X-Junkmail-SD-Raw: score=unknown, refid=str=0001.0A09020B.479D37E8.00DA,ss=1,fgs=0, ip=129.22.104.221, so=2007-10-30 19:00:17, dmn=5.4.3/2007-11-16 X-Junkmail-IWF: false X-detected-kernel: by monty-python.gnu.org: Genre and OS details not recognized. Cc: bug-bash@gnu.org, abi@e-arroyo.net Subject: Re: Exit application with two function calls X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Jan 2008 02:03:57 -0000 Linda Walsh wrote: > # *1 - using "-e" stops your script immediately on any error Not any error - only those from simple commands. The subtleties are subtle enough that I avoid -e, and use "&&" between all commands instead. paul From MAILER-DAEMON Mon Jan 28 01:01:31 2008 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1JJN3j-0000fi-Gc for mharc-bug-bash@gnu.org; Mon, 28 Jan 2008 01:01:31 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JJN3f-0000dU-OP for bug-bash@gnu.org; Mon, 28 Jan 2008 01:01:27 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JJN3d-0000cs-CZ for bug-bash@gnu.org; Mon, 28 Jan 2008 01:01:26 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JJN3d-0000cp-7u for bug-bash@gnu.org; Mon, 28 Jan 2008 01:01:25 -0500 Received: from rv-out-0910.google.com ([209.85.198.189]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JJN3c-0006g7-UP for bug-bash@gnu.org; Mon, 28 Jan 2008 01:01:25 -0500 Received: by rv-out-0910.google.com with SMTP id c27so2408620rvf.6 for ; Sun, 27 Jan 2008 22:01:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:user-agent:mime-version:to:subject:content-type:content-transfer-encoding; bh=lDwxf8lIEvzHcXuOKZq7VxqcPlC45CtCx9ZJeF3hvfg=; b=Dde7mo37PN5eGSCHheYF/DhYs6QCFsvnm/Z0n+asW3Ww7qN/GUbAJBxdblJFO4OXkz3NChe8786c5iBWFn23nmmmot1oBoJzP+VR2A6U59SD0TxNCPtXXix1xSAaqObyW5Dfp0KCAMg8OJ8kRnLi/KONmTiw4ERhv1+BylbmyhY= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:subject:content-type:content-transfer-encoding; b=IuL0yXgbcrS2srd8UVTgLXTFsp899yNhzn8i/6ZH4azOA2eWZCZ6cCqwHlSEXxG2uwW3tOTkriMNtl9E1lDVj0N4FfsMKy7vpqvv7LleP7RA3spACdgRzWqrJd3pt6FFsBhXyywU0SFaJ0Fx5MAoVk4HD2IGxhmxDVIHOtlABJI= Received: by 10.141.152.8 with SMTP id e8mr3178404rvo.19.1201500082599; Sun, 27 Jan 2008 22:01:22 -0800 (PST) Received: from ?113.168.0.120? ( [202.101.116.9]) by mx.google.com with ESMTPS id g21sm4370053rvb.29.2008.01.27.22.01.19 (version=TLSv1/SSLv3 cipher=RC4-MD5); Sun, 27 Jan 2008 22:01:21 -0800 (PST) Message-ID: <479D6FA6.1050100@gmail.com> Date: Mon, 28 Jan 2008 14:01:10 +0800 From: =?UTF-8?B?IkNoZW4gKOmZiCkgSnVuICjlhpspIg==?= User-Agent: Thunderbird 2.0.0.9 (Windows/20071031) MIME-Version: 1.0 To: bug-bash@gnu.org Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-detected-kernel: by monty-python.gnu.org: Linux 2.6 (newer, 2) Subject: Is there a Windows native port of Bash or Bourne Shell(no cygwin)? X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Jan 2008 06:01:28 -0000 Hi, everyone, I'm new to this list. I'd like to ask is there a Windows native port of Bash or Bourne Shell? By saying "Windows native", I mean that this shell program does not rely on cygwin. More specifically, it has the following characteristics: * The built-in command pwd should return Windows style full path, e.g. C:/mydir , so that this path can be passed to Windows native programs without any translation to result in a valid Windows file-system path. * The path such as C:/mydir should be recognize as a absolute path instead of a relative path in every corn of the shell program. Example: if the PATH env-var contains "C:/mydir:D:/myprg", it should be recognized as C:/mydir and D:/myprg . * If the current working dir is C:/mydir , and there is abc.txt in it, the result of command [ ABC.TXT -ef c:/mydir/abc.txt ] should be true. * Since it runs on Windows, features like job control can be omitted. Of course, aside from mentioned above. there may be some aspect I 've neglected regarding the path representation problem. I've been using a quite OK implementation of such Bourne Shell(sh.exe) on Windows since year 2003. It had been available from http://www.mame.net/zips/mingw-over-092.zip until October 2007. Now, that URL has been invalid, probably due to that sh.exe can not work well with Windows Vista. What' more, I cannot find source code of that sh.exe from www.mame.net, and even the binary can be found no where except from www.mame.net . I really hope to have such a Windows native shell to make it work on Vista. If I can't find one, I would like to write one myself. But why not use cygwin? There are several points. * It prefers Unix style path representation, i.e. /dir1/dir2 which is not compatible with Windows native programs. * It imposes only one instance of cygwin1.dll running inside Windows. * It's too slow. I can feel it when I do lots of trivial file read/write. Thank you in advance. From MAILER-DAEMON Mon Jan 28 05:50:17 2008 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1JJRZB-0000F5-5p for mharc-bug-bash@gnu.org; Mon, 28 Jan 2008 05:50:17 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JJRZ8-0000DV-5O for bug-bash@gnu.org; Mon, 28 Jan 2008 05:50:14 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JJRZ6-0000Ce-CZ for bug-bash@gnu.org; Mon, 28 Jan 2008 05:50:13 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JJRZ4-0000CD-53 for bug-bash@gnu.org; Mon, 28 Jan 2008 05:50:11 -0500 Received: from mx2.suse.de ([195.135.220.15]) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1JJRZ3-0003Dl-Mf for bug-bash@gnu.org; Mon, 28 Jan 2008 05:50:09 -0500 Received: from Relay2.suse.de (mail2.suse.de [195.135.221.8]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx2.suse.de (Postfix) with ESMTP id 47ECA30986; Mon, 28 Jan 2008 11:50:07 +0100 (CET) From: Andreas Schwab To: Linda Walsh References: <20129.75.37.15.205.1201442587.squirrel@www.e-arroyo.net> <479D2100.1050106@tlinx.org> X-Yow: A KAISER ROLL?! What good is a Kaiser Roll without a little COLE SLAW on the SIDE? Date: Mon, 28 Jan 2008 11:50:06 +0100 In-Reply-To: <479D2100.1050106@tlinx.org> (Linda Walsh's message of "Sun\, 27 Jan 2008 16\:25\:36 -0800") Message-ID: User-Agent: Gnus/5.110006 (No Gnus v0.6) Emacs/22.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable X-detected-kernel: by monty-python.gnu.org: Linux 2.4-2.6 Cc: bug-bash@gnu.org, abi@e-arroyo.net Subject: Re: Exit application with two function calls X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Jan 2008 10:50:14 -0000 Linda Walsh writes: > Check_file () > { > if [[ -d "$1" ]]; then echo "$1" # *4 > else return Error "invalid directory: \"$1\""; fi "return" expects a number, not the string "Error" as the first argument and does not take any further arguments. Andreas. --=20 Andreas Schwab, SuSE Labs, schwab@suse.de SuSE Linux Products GmbH, Maxfeldstra=DFe 5, 90409 N=FCrnberg, Germany PGP key fingerprint =3D 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED= 5 "And now for something completely different." From MAILER-DAEMON Mon Jan 28 07:12:38 2008 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1JJSqs-0005iA-Ki for mharc-bug-bash@gnu.org; Mon, 28 Jan 2008 07:12:38 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JJSqq-0005fd-Hc for bug-bash@gnu.org; Mon, 28 Jan 2008 07:12:36 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JJSqp-0005ev-Vk for bug-bash@gnu.org; Mon, 28 Jan 2008 07:12:36 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JJSqp-0005ej-T2 for bug-bash@gnu.org; Mon, 28 Jan 2008 07:12:35 -0500 Received: from ishtar.tlinx.org ([64.81.245.74]) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1JJSqp-0003II-Lj for bug-bash@gnu.org; Mon, 28 Jan 2008 07:12:35 -0500 Received: from [192.168.3.11] (Athena [192.168.3.11]) by ishtar.tlinx.org (8.13.3/8.12.10/SuSE Linux 0.7) with ESMTP id m0SCCF6o008989; Mon, 28 Jan 2008 04:12:15 -0800 Message-ID: <479DC694.9080807@tlinx.org> Date: Mon, 28 Jan 2008 04:12:04 -0800 From: Linda Walsh User-Agent: Thunderbird 2.0.0.9 (Windows/20071031) MIME-Version: 1.0 To: Andreas Schwab References: <20129.75.37.15.205.1201442587.squirrel@www.e-arroyo.net> <479D2100.1050106@tlinx.org> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-detected-kernel: by monty-python.gnu.org: Linux 2.6 (newer, 2) Cc: bug-bash@gnu.org, abi@e-arroyo.net Subject: Re: Exit application with two function calls X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Jan 2008 12:12:36 -0000 Dang---you're right of course. Didn't test the error case...too used to perl. That's why I drag myself through shell scripts trying to do things I might be tempted to do in perl...*sigh* probably have to resort to a else block, running "Error", then returning the status, i.e.: --- else Error "invalid directory: "\$1\"" return $? fi --- Andreas Schwab wrote: > Linda Walsh writes: > >> Check_file () >> { >> if [[ -d "$1" ]]; then echo "$1" # *4 >> else return Error "invalid directory: \"$1\""; fi > > "return" expects a number, not the string "Error" as the first argument > and does not take any further arguments. > > Andreas. > From MAILER-DAEMON Mon Jan 28 08:20:56 2008 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1JJTuy-0008BH-IF for mharc-bug-bash@gnu.org; Mon, 28 Jan 2008 08:20:56 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JJTuv-000899-Lz for bug-bash@gnu.org; Mon, 28 Jan 2008 08:20:53 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JJTus-00087y-SM for bug-bash@gnu.org; Mon, 28 Jan 2008 08:20:52 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JJTus-00087v-Mf for bug-bash@gnu.org; Mon, 28 Jan 2008 08:20:50 -0500 Received: from qmta06.westchester.pa.mail.comcast.net ([76.96.62.56]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JJTus-0005Bt-Ns for bug-bash@gnu.org; Mon, 28 Jan 2008 08:20:50 -0500 Received: from OMTA14.westchester.pa.mail.comcast.net ([76.96.62.60]) by QMTA06.westchester.pa.mail.comcast.net with comcast id ic0G1Y0011HzFnQ0504Y00; Mon, 28 Jan 2008 13:20:43 +0000 Received: from [192.168.0.103] ([67.166.125.73]) by OMTA14.westchester.pa.mail.comcast.net with comcast id idLh1Y0051b8C2B3a00000; Mon, 28 Jan 2008 13:20:43 +0000 X-Authority-Analysis: v=1.0 c=1 a=7gyxgLtBGycA:10 a=xe8BsctaAAAA:8 a=aOlmbA0LJJk_3L6X5zUA:9 a=5MGzTbYavBBjFZvGLUKu93Ric10A:4 a=eDFNAWYWrCwA:10 a=_KP80YOJyZ0A:10 a=rPt6xJ-oxjAA:10 Message-ID: <479DD6E0.7060701@byu.net> Date: Mon, 28 Jan 2008 06:21:36 -0700 From: Eric Blake User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.9) Gecko/20071031 Thunderbird/2.0.0.9 Mnenhy/0.7.5.666 MIME-Version: 1.0 To: =?UTF-8?B?IkNoZW4gKOmZiCkgSnVuICjlhpspIg==?= References: <479D6FA6.1050100@gmail.com> In-Reply-To: <479D6FA6.1050100@gmail.com> X-Enigmail-Version: 0.95.6 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-detected-kernel: by monty-python.gnu.org: Genre and OS details not recognized. Cc: bug-bash@gnu.org Subject: Re: Is there a Windows native port of Bash or Bourne Shell(no cygwin)? X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Jan 2008 13:20:54 -0000 -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 According to Chen (陈) Jun (军) on 1/27/2008 11:01 PM: | Hi, everyone, | | I'm new to this list. I'd like to ask is there a Windows native port of | Bash or Bourne Shell? Yes. Search for the MSYS project (layered on top of mingw). If it doesn't work on vista yet, then they would probably welcome your help. - -- Don't work too hard, make some time for fun as well! Eric Blake ebb9@byu.net -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.5 (Cygwin) Comment: Public key at home.comcast.net/~ericblake/eblake.gpg Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFHndbg84KuGfSFAYARAr6wAJ97pXrrpJeTAtwEFjoZ+Yd7+fylwgCgy6/2 Dv9jlO4HadEfOb1oK9oqB24= =Gi+R -----END PGP SIGNATURE----- From MAILER-DAEMON Mon Jan 28 11:16:43 2008 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1JJWf5-0003YL-Gn for mharc-bug-bash@gnu.org; Mon, 28 Jan 2008 11:16:43 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JJWf4-0003YG-63 for bug-bash@gnu.org; Mon, 28 Jan 2008 11:16:42 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JJWf2-0003Y7-NL for bug-bash@gnu.org; Mon, 28 Jan 2008 11:16:40 -0500 Received: from m4.goneo.de ([82.100.220.86]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JJWf2-00042c-Mq for bug-bash@gnu.org; Mon, 28 Jan 2008 11:16:40 -0500 Received: from localhost (localhost.goneo.de [127.0.0.1]) by scan.goneo.de (Postfix) with ESMTP id 80F0F575462 for ; Mon, 28 Jan 2008 17:16:38 +0100 (CET) X-Virus-Scanned: by goneo X-Spam-Score: -2.599 Received: from m4.goneo.de ([127.0.0.1]) by localhost (m4.goneo.de [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 6VHAUiPPc1Ie for ; Mon, 28 Jan 2008 17:16:23 +0100 (CET) Received: from [192.168.178.2] (d128194.adsl.hansenet.de [80.171.128.194]) by m2-smtp.goneo.de (Postfix) with ESMTP id 29411575425 for ; Mon, 28 Jan 2008 17:16:22 +0100 (CET) Message-ID: <479DFFD6.3020005@sudrala.de> Date: Mon, 28 Jan 2008 17:16:22 +0100 From: Bernd Eggink User-Agent: Thunderbird 2.0.0.9 (X11/20071031) MIME-Version: 1.0 To: bug-bash@gnu.org References: <479D3740.6080406@tlinx.org> In-Reply-To: <479D3740.6080406@tlinx.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-detected-kernel: by monty-python.gnu.org: FreeBSD 6.x (1) Subject: Re: capturing sub-expressions? X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Jan 2008 16:16:42 -0000 Linda Walsh schrieb: > 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? > > If the full expression was in a shellvar "Options", I thought about > using something like: > ${Option//!(expr)} > which I hoped would have "!(expr) match anything but my desired > expression, and the double "/" would say allow it to match multiple > times, but it appears the "!()" construct is limited to pathname > expansion? Presuming that is true (limited to pathname expansion), > is there anyway to do it on Shell vars? > > I keep confusing the path-matching regular expressions with > string-matching expressions and keep getting disappointed when I'm > re-reminded of the limitation...:-( There should be no difference between path-matching and string-matching expressions. Normally even nested extended patterns work with string matching. But, in fact, !(...) appears to not work like one would expect. The only case that looked correct to me is the trivial one ${x//!(*)}, which leaves $x unchanged. I'm not sure whether this is a bug or I (we) miss something. Interestingly, ksh behaves the same way. Can anybody clarify this? Regards, Bernd -- Bernd Eggink monoped@sudrala.de http://sudrala.de From MAILER-DAEMON Mon Jan 28 16:34:37 2008 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1JJbcj-0006jV-Jz for mharc-bug-bash@gnu.org; Mon, 28 Jan 2008 16:34:37 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JJatm-0003Wg-KY for bug-bash@gnu.org; Mon, 28 Jan 2008 15:48:10 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JJatl-0003WT-0P for bug-bash@gnu.org; Mon, 28 Jan 2008 15:48:09 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JJatk-0003WQ-SX for bug-bash@gnu.org; Mon, 28 Jan 2008 15:48:08 -0500 Received: from colin.muc.de ([193.149.48.1] helo=mail.muc.de) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1JJatk-0006CQ-Ct for bug-bash@gnu.org; Mon, 28 Jan 2008 15:48:08 -0500 Received: (qmail 15701 invoked by uid 3782); 28 Jan 2008 20:48:06 -0000 Received: from acm.muc.de (p57AF63E7.dip.t-dialin.net [87.175.99.231]) by colin2.muc.de (tmda-ofmipd) with ESMTP; Mon, 28 Jan 2008 21:48:04 +0100 Received: (qmail 3422 invoked by uid 1000); 28 Jan 2008 20:58:58 -0000 Date: Mon, 28 Jan 2008 20:58:58 +0000 To: bug-bash@gnu.org Message-ID: <20080128205858.GB2513@muc.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.9i X-Delivery-Agent: TMDA/1.1.5 (Fettercairn) From: Alan Mackenzie X-Primary-Address: acm@muc.de X-detected-kernel: by monty-python.gnu.org: FreeBSD 4.6-4.9 X-Mailman-Approved-At: Mon, 28 Jan 2008 16:34:35 -0500 Subject: bash 2.05b.0(1)-release on Debian Sarge: [A-Z]* expands as [A-Za-z]* :-( X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Jan 2008 20:48:10 -0000 Hi, bash! Sometimes, (like in a source directory), I want to ls files whose name begins with a capital letter, and so do this: % ls [A-Z]* . Sadly, ls ignores my intentions and undiscerningly prints a list of all files whose names begin with a letter, big or small. Yes, I've read the fine manual and tried: % shopt -u nocaseglob , but to no avail. Am I missing something obvious, or have I hit a bug? Thanks in advance for any help! -- Alan Mackenzie (Nuremberg, Germany). From MAILER-DAEMON Mon Jan 28 16:49:12 2008 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1JJbqp-0007FB-T4 for mharc-bug-bash@gnu.org; Mon, 28 Jan 2008 16:49:11 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JJbqo-0007En-DT for bug-bash@gnu.org; Mon, 28 Jan 2008 16:49:10 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JJbqn-0007EV-FB for bug-bash@gnu.org; Mon, 28 Jan 2008 16:49:10 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JJbqn-0007EO-7N for bug-bash@gnu.org; Mon, 28 Jan 2008 16:49:09 -0500 Received: from pamir.yandex.ru ([87.250.244.41]) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1JJbqm-0002Zo-LF for bug-bash@gnu.org; Mon, 28 Jan 2008 16:49:09 -0500 Received: from fireball.yandex.ru (fireball.yandex.ru [213.180.193.104]) by pamir.yandex.ru (8.14.2/8.13.8) with ESMTP id m0SLn4hA068640; Tue, 29 Jan 2008 00:49:04 +0300 (MSK) (envelope-from nga@fireball.yandex.ru) Received: by fireball.yandex.ru (Postfix, from userid 2105) id 3247AE4465; Tue, 29 Jan 2008 00:49:03 +0300 (MSK) From: yozh@mx1.ru To: bug-bash@gnu.org, yozh@mx1.ru Message-Id: <20080128214903.3247AE4465@fireball.yandex.ru> Date: Tue, 29 Jan 2008 00:49:03 +0300 (MSK) X-detected-kernel: by monty-python.gnu.org: FreeBSD 6.x (1) Cc: Subject: -e does not work properly with subscript X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Jan 2008 21:49:10 -0000 Configuration Information [Automatically generated, do not change]: Machine: i386 OS: linux-gnu Compiler: gcc Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='i386' -DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='i386-pc-linux-gnu' -DCONF_VENDOR='pc' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash' -DSHELL -DHAVE_CONFIG_H -I. -I../bash -I../bash/include -I../bash/lib -g -O2 uname output: Linux fireball 2.6.20-1-686-bigmem #1 SMP Wed Apr 25 11:30:36 UTC 2007 i686 GNU/Linux Machine Type: i386-pc-linux-gnu Bash Version: 3.0 Patch Level: 16 Release Status: release Description: failed subscript should cause script to exit if set -e Repeat-By: % cat aa.sh set -e ( false ) echo "end" % bash aa.sh end % zsh aa.sh zsh: exit 1 zsh aa.sh Script aa.sh should print nothing and exit with error. Under bash it prints "end" and exits with 0 code. From MAILER-DAEMON Mon Jan 28 17:10:12 2008 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1JJcB9-0000TA-S1 for mharc-bug-bash@gnu.org; Mon, 28 Jan 2008 17:10:11 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JJcB8-0000ST-CK for bug-bash@gnu.org; Mon, 28 Jan 2008 17:10:10 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JJcB6-0000RR-LO for bug-bash@gnu.org; Mon, 28 Jan 2008 17:10:09 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JJcB6-0000RF-97 for bug-bash@gnu.org; Mon, 28 Jan 2008 17:10:08 -0500 Received: from qmta03.emeryville.ca.mail.comcast.net ([76.96.30.32]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JJcB5-0006lL-Lb for bug-bash@gnu.org; Mon, 28 Jan 2008 17:10:07 -0500 Received: from OMTA08.emeryville.ca.mail.comcast.net ([76.96.30.12]) by QMTA03.emeryville.ca.mail.comcast.net with comcast id im891Y00J0FhH240A00900; Mon, 28 Jan 2008 22:10:06 +0000 Received: from [192.168.0.103] ([67.166.125.73]) by OMTA08.emeryville.ca.mail.comcast.net with comcast id imA41Y00R1b8C2B8U00000; Mon, 28 Jan 2008 22:10:06 +0000 X-Authority-Analysis: v=1.0 c=1 a=3pJ9r7QidioA:10 a=xe8BsctaAAAA:8 a=VokLlgsZ0VClGyeCYugA:9 a=09DDCq2XXPce983Ttr_0k8JNLQ4A:4 a=eDFNAWYWrCwA:10 a=rPt6xJ-oxjAA:10 Message-ID: <479E52BC.5080204@byu.net> Date: Mon, 28 Jan 2008 15:10:04 -0700 From: Eric Blake User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.9) Gecko/20071031 Thunderbird/2.0.0.9 Mnenhy/0.7.5.666 MIME-Version: 1.0 To: Alan Mackenzie References: <20080128205858.GB2513@muc.de> In-Reply-To: <20080128205858.GB2513@muc.de> X-Enigmail-Version: 0.95.6 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-detected-kernel: by monty-python.gnu.org: Genre and OS details not recognized. Cc: bug-bash@gnu.org Subject: Re: bash 2.05b.0(1)-release on Debian Sarge: [A-Z]* expands as [A-Za-z]* :-( X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Jan 2008 22:10:10 -0000 -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 According to Alan Mackenzie on 1/28/2008 1:58 PM: | | . Sadly, ls ignores my intentions and undiscerningly prints a list of | all files whose names begin with a letter, big or small. Actually, it follows your (unintended) directions, thanks to your current locale, which does a collation sort. You aren't doing [A-Za-z], but [AaBb...Z], because your current locale prefers case-insensitive collation. Change your locale (try LC_COLLATE=C or LC_ALL=C) to see the difference. - -- Don't work too hard, make some time for fun as well! Eric Blake ebb9@byu.net -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.5 (Cygwin) Comment: Public key at home.comcast.net/~ericblake/eblake.gpg Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFHnlK784KuGfSFAYARAgrVAJkBB52JX8Z3KU82GUDWGR+VubkvRwCeP/Q+ bUcUGQjd0L3iZ0oNNp/SC/M= =IJqX -----END PGP SIGNATURE----- From MAILER-DAEMON Mon Jan 28 17:25:30 2008 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1JJcPy-0006Z5-Ee for mharc-bug-bash@gnu.org; Mon, 28 Jan 2008 17:25:30 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JJcPw-0006Xu-4B for bug-bash@gnu.org; Mon, 28 Jan 2008 17:25:28 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JJcPv-0006Wt-02 for bug-bash@gnu.org; Mon, 28 Jan 2008 17:25:27 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JJcPu-0006We-OA for bug-bash@gnu.org; Mon, 28 Jan 2008 17:25:26 -0500 Received: from [89.188.104.144] (helo=hilbert) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1JJcPu-0001f0-7c for bug-bash@gnu.org; Mon, 28 Jan 2008 17:25:26 -0500 Received: from stepancheg by hilbert with local (Exim 4.63) (envelope-from ) id 1JJbel-0002SN-LD; Tue, 29 Jan 2008 00:36:43 +0300 From: yozh@mx1.ru To: bug-bash@gnu.org,bash@packages.debian.org Message-Id: Date: Tue, 29 Jan 2008 00:36:43 +0300 X-detected-kernel: by monty-python.gnu.org: Linux 2.6 (newer, 2) X-Greylist: delayed 2916 seconds by postgrey-1.27 at monty-python; Mon, 28 Jan 2008 17:25:22 EST Cc: Subject: -e does not work with subscript X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Jan 2008 22:25:28 -0000 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' -DCONF_VENDOR='pc' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash' -DSHELL -DHAVE_CONFIG_H -I. -I../bash -I../bash/include -I../bash/lib -g -O2 uname output: Linux hilbert 2.6.18-openvz-amd64 #1 SMP Tue Apr 10 19:34:07 MSD 2007 i686 GNU/Linux Machine Type: i486-pc-linux-gnu Bash Version: 3.1 Patch Level: 17 Release Status: release Description: failed subscript does not cause script to exit, while -e is set Repeat-By: % cat aa.sh set -e ( false ) echo "unreachable" % bash ./aa.sh unreachable % zsh ./aa.sh zsh: exit 1 zsh ./aa.sh Script aa.sh is expected to exit with error and print nothing. In bash it prints "unreachable". From MAILER-DAEMON Mon Jan 28 18:57:26 2008 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1JJdqw-0007uW-EN for mharc-bug-bash@gnu.org; Mon, 28 Jan 2008 18:57:26 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JJdqv-0007sa-90 for bug-bash@gnu.org; Mon, 28 Jan 2008 18:57:25 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JJdqt-0007pe-Jr for bug-bash@gnu.org; Mon, 28 Jan 2008 18:57:24 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JJdqt-0007pM-Ad for bug-bash@gnu.org; Mon, 28 Jan 2008 18:57:23 -0500 Received: from joseki.proulx.com ([216.17.153.58]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JJdqs-0002sk-TI for bug-bash@gnu.org; Mon, 28 Jan 2008 18:57:23 -0500 Received: from dementia.proulx.com (dementia.proulx.com [192.168.1.115]) by joseki.proulx.com (Postfix) with ESMTP id 6950CFAD6; Mon, 28 Jan 2008 16:57:22 -0700 (MST) Received: by dementia.proulx.com (Postfix, from userid 1000) id 5D22B3CC64D; Mon, 28 Jan 2008 16:57:22 -0700 (MST) Date: Mon, 28 Jan 2008 16:57:22 -0700 To: bug-bash@gnu.org, Alan Mackenzie Message-ID: <20080128235722.GA12751@dementia.proulx.com> Mail-Followup-To: bug-bash@gnu.org, Alan Mackenzie References: <20080128205858.GB2513@muc.de> <479E52BC.5080204@byu.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <479E52BC.5080204@byu.net> User-Agent: Mutt/1.5.13 (2006-08-11) From: bob@proulx.com (Bob Proulx) X-detected-kernel: by monty-python.gnu.org: Genre and OS details not recognized. Cc: Subject: Re: bash 2.05b.0(1)-release on Debian Sarge: [A-Z]* expands as [A-Za-z]* :-( X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Jan 2008 23:57:25 -0000 Eric Blake wrote: > According Alan Mackenzie: > | % ls [A-Z]* > | . Sadly, ls ignores my intentions and undiscerningly prints a list of > | all files whose names begin with a letter, big or small. > > Actually, it follows your (unintended) directions, thanks to your current > locale, which does a collation sort. You aren't doing [A-Za-z], but > [AaBb...Z], because your current locale prefers case-insensitive > collation. Change your locale (try LC_COLLATE=C or LC_ALL=C) to see the > difference. Or in the new expression syntax say that you are looking for upper case letters explicitly. ls -d [[:upper:]]* That should work regardless of locale setting. Bob From MAILER-DAEMON Mon Jan 28 22:10:15 2008 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1JJgrX-0004JP-Gv for mharc-bug-bash@gnu.org; Mon, 28 Jan 2008 22:10:15 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JJgrV-0004J8-DG for bug-bash@gnu.org; Mon, 28 Jan 2008 22:10:13 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JJgrQ-0004IW-Pi for bug-bash@gnu.org; Mon, 28 Jan 2008 22:10:13 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JJgrQ-0004IT-NI for bug-bash@gnu.org; Mon, 28 Jan 2008 22:10:08 -0500 Received: from fk-out-0910.google.com ([209.85.128.191]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JJgrQ-00015X-Jl for bug-bash@gnu.org; Mon, 28 Jan 2008 22:10:08 -0500 Received: by fk-out-0910.google.com with SMTP id 26so1323838fkx.10 for ; Mon, 28 Jan 2008 19:10:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:references; bh=CQaDqCyiThdtPOv8K9HHjkCapV91tWa4TH1tq+A8X44=; b=hQ/e4ePx4DL9W4dyZygtiIYBKBExL9JM8ie7zJjRo6NLtlb7pFWf0YZQ/7wzM/ZEcxqaWpRm7n7VgvM/QSJR/yBfpgci0b1oSnrPb1TE7odGCGaVW5+uddw0mY5uT+XtzziEagyWLIAgFcWzmZ5OwgeczzF265Z+nVNxwkTRNUc= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:in-reply-to:mime-version:content-type:references; b=BIMOt++zJD5uuBCHXT+b68TI9aShafnH0D8yfhOi1WJoqgYjQPGn/9QI4MbENBzHZUL4QiBDAXkiR8xbvFU/YLGP7xwsKXN/WIoIH7CikvqZ8j5yBEzKnHKjfmUu1EMfFpnsZh7jJb7qFHsW832HqbCAgn7otLxdAaLvBGk/eZ8= Received: by 10.78.159.7 with SMTP id h7mr8586905hue.8.1201576207087; Mon, 28 Jan 2008 19:10:07 -0800 (PST) Received: by 10.78.180.13 with HTTP; Mon, 28 Jan 2008 19:10:07 -0800 (PST) Message-ID: Date: Tue, 29 Jan 2008 11:10:07 +0800 From: "=?UTF-8?Q?Chen(=E9=99=88)_Jun(=E5=86=9B)?=" To: bug-bash@gnu.org In-Reply-To: <479DD6E0.7060701@byu.net> MIME-Version: 1.0 References: <479D6FA6.1050100@gmail.com> <479DD6E0.7060701@byu.net> X-detected-kernel: by monty-python.gnu.org: Linux 2.6 (newer, 2) Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: base64 Content-Disposition: inline X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Subject: Re: Is there a Windows native port of Bash or Bourne Shell(no cygwin)? X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Jan 2008 03:10:14 -0000 T24gMS8yOC8wOCwgRXJpYyBCbGFrZSA8ZWJiOUBieXUubmV0PiB3cm90ZToKPgo+IC0tLS0tQkVH SU4gUEdQIFNJR05FRCBNRVNTQUdFLS0tLS0KPiBIYXNoOiBTSEExCj4KPiBBY2NvcmRpbmcgdG8g Q2hlbiAo6ZmIKSBKdW4gKOWGmykgb24gMS8yNy8yMDA4IDExOjAxIFBNOgo+IHwgSGksIGV2ZXJ5 b25lLAo+IHwKPiB8IEknbSBuZXcgdG8gdGhpcyBsaXN0LiBJJ2QgbGlrZSB0byBhc2sgaXMgdGhl cmUgYSBXaW5kb3dzIG5hdGl2ZSBwb3J0IG9mCj4gfCBCYXNoIG9yIEJvdXJuZSBTaGVsbD8KPgo+ IFllcy4gIFNlYXJjaCBmb3IgdGhlIE1TWVMgcHJvamVjdCAobGF5ZXJlZCBvbiB0b3Agb2YgbWlu Z3cpLiAgSWYgaXQKPiBkb2Vzbid0IHdvcmsgb24gdmlzdGEgeWV0LCB0aGVuIHRoZXkgd291bGQg cHJvYmFibHkgd2VsY29tZSB5b3VyIGhlbHAuCgoKIFRoYW5rIHlvdSBFcmljLCBidXQgTVNZUyBp cyBub3Qgd2hhdCBJJ3ZlIGV4cGVjdGVkLiBJJ3ZlIGtub3cgTVNZUyBzaW5jZQp5ZWFyIDIwMDQs IGFuZCBJJ3ZlIGZvdW5kIGl0IHRvdGFsbHkgYSB3ZWlyZG8uIElmIEkgd291bGQgd2FudCB0byBi dWlsZApzb21ldGhpbmcgZnJvbSBVbml4IHdvcmxkIHRoYXQgbmVlZHMgYSBiYXNoIGVudmlyb25t ZW50LCBJIHdvdWxkIHR1cm4gdG8KTGludXggb3IgY3lnd2luIGluc3RlYWQgb2YgTVNZUy4KCkxl dCdzIGNoZWNrIHdoYXQgc2guZXhlIGZyb20gTVNZUygxLjAuMTApIGRvLiBJIGluc3RhbGwgTVNZ UyBzbyB0aGF0IHRoZXJlCmlzIEU6L21zeXMvMS4wL2Jpbi9zaC5leGUgOyBJIGNoYW5nZSBteSB3 b3JraW5nIGRpcmVjdG9yeSB0byBFOlxtc3lzXDEuMFxiaW4KLgoKTm93LCBsZXRzIGlzc3VlIGNv bW1hbmQKCnNoIC1jICJwd2QiCgpJdCBvdXRwdXRzOgoKL2JpbgoKT291dXBzLCB3aGF0IEkgZXhw ZWN0IHdhcyBFOi9tc3lzLzEuMC9iaW4gLgoKTm93LCBJJ3ZlIHByZXBhcmVkIGEgcHJvZ3JhbSBj YWxsZWQgc2hvd2FyZ3MsIHdobyBzaG93cyBhcmd2WzBdLCBhcmd2WzFdIGV0YwpwYXNzZWQgdG8g aXQuIExldCdzIHRyeSBpdCB3aXRoIE1TWVMncyBzaC5leGUuCgo+Pj4+Pj4+Pj4+Pj4+Pj4+PgpF Olxtc3lzXDEuMFxiaW4+c2ggLWMgIi4vc2hvd2FyZ3MgLW9wdCAvYyAvZXMiCmFyZ2M9NC4KKDI4 KWFyZ3ZbMF06IEU6XG1zeXNcMS4wXGJpblxzaG93YXJncy5leGUKKDQpYXJndlsxXTogLW9wdAoo Mylhcmd2WzJdOiBjOi8KKDE0KWFyZ3ZbM106IEU6L21zeXMvMS4wL2VzCjw8PDw8PDw8PDw8PDw8 PDw8CgpTdXByaXNlZD8gWW91IG5vdyBrbm93IHdoYXQgdGhlIHdlaXJkIHNoLmV4ZSBkb2VzLiBJ dCBjaGVja3Mgd2hldGhlciBzb21lCnRva2VuIHN0YXJ0cyB3aXRoIC8gLCBpZiBzbywgaXQgY29u c2lkZXJzIHRoYXQgdG9rZSBhIHBhdGggYW5kIGFwcGxpZXMKdHJhc2Zvcm1hdGlvbi4gVGhpcyBp cyB1dHRlcmx5IHJ1ZGUuIFNvIHRoaXMgc2guZXhlIGNhbm5vdCBjb29wZXJhdGUgd2l0aAptYW55 IGV4aXN0aW5nIFdpbmRvd3MgcHJvZ3JhbXMuCg== From MAILER-DAEMON Tue Jan 29 02:08:20 2008 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1JJkZw-0000YF-5i for mharc-bug-bash@gnu.org; Tue, 29 Jan 2008 02:08:20 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JJkZu-0000Xv-92 for bug-bash@gnu.org; Tue, 29 Jan 2008 02:08:18 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JJkZp-0000Wl-NE for bug-bash@gnu.org; Tue, 29 Jan 2008 02:08:17 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JJkZp-0000Wi-JZ for bug-bash@gnu.org; Tue, 29 Jan 2008 02:08:13 -0500 Received: from wr-out-0506.google.com ([64.233.184.230]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JJkZp-0006JH-Bc for bug-bash@gnu.org; Tue, 29 Jan 2008 02:08:13 -0500 Received: by wr-out-0506.google.com with SMTP id 37so1113362wra.12 for ; Mon, 28 Jan 2008 23:08:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; bh=v7KZWIfbivX0UZimwMi/YYgoYiRGhWtsP0+yOPGaPK0=; b=InuAcIAPw6V8Ow5nXJFVTVutduxvz33Py18KCGFG23xdfr9TqpPybVUQZVM7dkuBAmW9FwpTAo3wFX7n2Z5y3TCBjjHSLpNvBcit8MS5ZZ1LOFH/+tpuNMXi7iNQ08oosu0dImGZgGoRxcUxnKXAhKlRddRjeIhzD94oBKnBHJQ= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=D2sMt3aDBa/FnVhHTiZ5uqwrXk0Cx7JLaGFEes6AA0QGTIQa0meUS6llhjCS/4UhP9quQLJvFml62vchO6ZHYUZSzkqIv0i5hpF97K1l1D1AVht8HGOFctNFuxi/8PkzupMvxttolb3ZAlngTVI3YP6dITWIxwNTD9Wtz4+ojNc= Received: by 10.150.226.15 with SMTP id y15mr2546194ybg.145.1201590492124; Mon, 28 Jan 2008 23:08:12 -0800 (PST) Received: by 10.150.146.15 with HTTP; Mon, 28 Jan 2008 23:08:12 -0800 (PST) Message-ID: Date: Tue, 29 Jan 2008 09:08:12 +0200 From: "Pierre Gaston" To: yozh@mx1.ru In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: X-detected-kernel: by monty-python.gnu.org: Linux 2.4-2.6 (Google crawlbot) Cc: bug-bash@gnu.org, bash@packages.debian.org Subject: Re: -e does not work with subscript X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Jan 2008 07:08:18 -0000 On Jan 28, 2008 11:36 PM, 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' -DCONF_VENDOR='pc' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash' -DSHELL -DHAVE_CONFIG_H -I. -I../bash -I../bash/include -I../bash/lib -g -O2 > uname output: Linux hilbert 2.6.18-openvz-amd64 #1 SMP Tue Apr 10 19:34:07 MSD 2007 i686 GNU/Linux > Machine Type: i486-pc-linux-gnu > > Bash Version: 3.1 > Patch Level: 17 > Release Status: release > > Description: > failed subscript does not cause script to exit, while -e is set > > Repeat-By: > > % cat aa.sh > set -e > > ( > false > ) > > echo "unreachable" > > % bash ./aa.sh > unreachable > % zsh ./aa.sh > zsh: exit 1 zsh ./aa.sh > > Script aa.sh is expected to exit with error and print nothing. In bash it prints "unreachable". > > bash exits the subshell you create with ( ) and not the shell: $ bash -ce '(false;echo foo);echo bar' bar From MAILER-DAEMON Tue Jan 29 02:32:34 2008 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1JJkxO-0002ih-Io for mharc-bug-bash@gnu.org; Tue, 29 Jan 2008 02:32:34 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JJkxM-0002ga-Sl for bug-bash@gnu.org; Tue, 29 Jan 2008 02:32:32 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JJkxL-0002fe-Qy for bug-bash@gnu.org; Tue, 29 Jan 2008 02:32:32 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JJkxL-0002fR-Kl for bug-bash@gnu.org; Tue, 29 Jan 2008 02:32:31 -0500 Received: from wx-out-0506.google.com ([66.249.82.226]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JJkxL-00024A-EU for bug-bash@gnu.org; Tue, 29 Jan 2008 02:32:31 -0500 Received: by wx-out-0506.google.com with SMTP id s7so1572806wxc.24 for ; Mon, 28 Jan 2008 23:32:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; bh=67HbOiyGp+1VsyPsHIKCZY+uhqi2CDvuH0p0N6RhB+s=; b=QkIzqzl89Lory+mKLvf2RAce9V16D+DlgbvnKj5OEa+9s2N40iev98tJAViaYPlgK1azw2SVcQ0FAuYqXDia2WUdgFSUsEWy4Ip/KVLAHq2UUl7JAYLPydhbHJj/eeim4UPqkQtfYFnJuOexHZxtt+7XXC/E5aFiqLnJFVUXR3k= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=HpM0wcXNukUmUGY9wwoxx+ZW/II96pim7qu3tG/cgfqdodpDi5f2yT3XlGhRRuLGLqlRcbnE9mg4E0w/fZvAVs6fNoObnUw0rw0n+3TGU3DqoZ2Xi4Uj19lAnKJ94JucLb5KZ9a2nXV6ZDfzUCIN6Rp1JO/28hSdfc/Vlu+7YpQ= Received: by 10.150.158.8 with SMTP id g8mr2562560ybe.94.1201591950248; Mon, 28 Jan 2008 23:32:30 -0800 (PST) Received: by 10.150.146.15 with HTTP; Mon, 28 Jan 2008 23:32:30 -0800 (PST) Message-ID: Date: Tue, 29 Jan 2008 09:32:30 +0200 From: "Pierre Gaston" To: "Linda Walsh" In-Reply-To: <479D3740.6080406@tlinx.org> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <479D3740.6080406@tlinx.org> X-detected-kernel: by monty-python.gnu.org: Linux 2.6 (newer, 2) Cc: bug-bash@gnu.org Subject: Re: capturing sub-expressions? X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Jan 2008 07:32:33 -0000 On Jan 28, 2008 4:00 AM, Linda Walsh 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? I don't think so, you can only use =~ and BASE_REMATCH > If the full expression was in a shellvar "Options", I thought about > using something like: > ${Option//!(expr)} > which I hoped would have "!(expr) match anything but my desired > expression, and the double "/" would say allow it to match multiple > times, but it appears the "!()" construct is limited to pathname > expansion? Presuming that is true (limited to pathname expansion), > is there anyway to do it on Shell vars? !( ) is indeed not very intuitive, it is not limited to pathname expansion but it is not as interesting as it might seem. !(expr) will match anything that is not expr, for instance !(foo) will match f and bar, but it also match "fooa", the only thing that is not match is exactly "foo", which is useful if you do: "echo !(foo)" to list all the files except the one named "foo". Now if you use parameter expansion : var=fooa;echo ${var//!(foo)/b} # prints "b" because !(foo) matches "fooa" var=foo; echo ${var/!(foo)/b} # prints "bo" because !(foo) matches "fo" var=foo; echo ${var/!(foo)/b} # prints "bb" because !(foo) matches "fo" and "o" (in the regexp world a corresponding surprising result is " echo foo | sed 's/m*/a/g' " where m* means 0 or more and thus match the 0m between each char) > I keep confusing the path-matching regular expressions with > string-matching expressions and keep getting disappointed when I'm > re-reminded of the limitation...:-( > Maybe an "RFE"?...(*sigh*) > Linda > > > > > From MAILER-DAEMON Tue Jan 29 02:37:04 2008 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1JJl1k-0004kH-Aq for mharc-bug-bash@gnu.org; Tue, 29 Jan 2008 02:37:04 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JJl1i-0004k3-7c for bug-bash@gnu.org; Tue, 29 Jan 2008 02:37:02 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JJl1g-0004jZ-Ex for bug-bash@gnu.org; Tue, 29 Jan 2008 02:37:01 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JJl1g-0004jV-8J for bug-bash@gnu.org; Tue, 29 Jan 2008 02:37:00 -0500 Received: from hs-out-0708.google.com ([64.233.178.249] helo=hs-out-2122.google.com) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JJl1f-0002rr-Rg for bug-bash@gnu.org; Tue, 29 Jan 2008 02:37:00 -0500 Received: by hs-out-2122.google.com with SMTP id 55so1974894hsc.10 for ; Mon, 28 Jan 2008 23:36:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; bh=E6DBUFQfSwz9OdgkCbdIW951OBARempidHKWi8J3qaA=; b=uyK9X9h9U1E3c9PiF+z+9RkQp0KUYH/lrcGknE0YU7P5b2ZJsNhcr4wWOub3Erx1Bt2EsMAJEvbxDwLlzGvi6poDW+P8BKbRtCCSyPLPIwHllO4JOBJ2Jj6PYKRnDz4gnDrWFxu7HX+LEjovCSOGu9+sY1cSJD23tOgKleHAook= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=v2MNHKxf8hizEmy0siEW/sF/WekoXZiMD7lvPIfH22HM3Smt9rp5BSL3RyWMwTet8wR01XNgTfjXq0JBSpvtQA4KYMZmPomA2ggXK9iRcJAII8brCDIiC5lqSurxd+lhrJULa+naptFQsbYeFEozmeliYYBaqKvtJVjL9KWFYeU= Received: by 10.150.149.19 with SMTP id w19mr2561103ybd.121.1201592217717; Mon, 28 Jan 2008 23:36:57 -0800 (PST) Received: by 10.150.146.15 with HTTP; Mon, 28 Jan 2008 23:36:57 -0800 (PST) Message-ID: Date: Tue, 29 Jan 2008 09:36:57 +0200 From: "Pierre Gaston" To: "=?GB2312?B?wfq6o8zO?=" In-Reply-To: <1201591941.4193.2.camel@localhost.localdomain> MIME-Version: 1.0 Content-Type: text/plain; charset=GB2312 Content-Transfer-Encoding: base64 Content-Disposition: inline References: <1201591941.4193.2.camel@localhost.localdomain> X-detected-kernel: by monty-python.gnu.org: Linux 2.4-2.6 (Google crawlbot) Cc: yozh@mx1.ru, bug-bash@gnu.org, bash@packages.debian.org Subject: Re: -e does not work with subscript X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Jan 2008 07:37:03 -0000 T24gSmFuIDI5LCAyMDA4IDk6MzIgQU0sIMH6uqPMziA8bG9uZ2hhaXRhb0BvdHNjLmNvbS5jbj4g d3JvdGU6Cj4KPiA+ICQgYmFzaCAtY2UgJyhmYWxzZTtlY2hvIGZvbyk7ZWNobyBiYXInCj4gPiBi YXIKPiBjb3VsZCBpIGFzayB3aGF0IHRoZSBjb21tYW5kIGxpbmUgb3B0aW9uICctZScgbWVhbj8K PiBpIGRpZCBub3QgZmluZCBhbnkgZXhwbGFuYXRpb24gaW4gYmFzaCdzIG1hbnVhbC4KCkl0IGhh cyB0aGUgc2FtZSBlZmZlY3QgYXMgc2V0IC1lLCB5b3UgY2FuIHBhc3MgdGhlIG9wdGlvbnMgb2Yg c2V0IHRvCmJhc2ggZGlyZWN0bHkgYmFzaCAteCBldGMuLi4KClRoZSBtYW51YWwgc2F5czoKIklu ICBhZGRpdGlvbiB0byB0aGUgc2luZ2xlLWNoYXJhY3RlciBzaGVsbCBvcHRpb25zIGRvY3VtZW50 ZWQgaW4gdGhlCmRlc2NyaXB0aW9uIG9mIHRoZSBzZXQgYnVpbHRpbiBjb21tYW5kLCBiYXNoIGlu dGVycHJldHMgdGhlIGZvbGxvd2luZwpvcHRpb25zIHdoZW4gaXQgaXMgaW52b2tlZDoiCgooYW5k IGRvbid0IHdvcnJ5IGZvciBub3QgZmluZGluZyBpdCwgSSBrbm93IGl0IGlzIGVhc2llciB0byBm aW5kIHdoYXQKeW91IHdhbnQgd2hlbiB5b3UgYWxyZWFkeSBrbm93IHdoYXQgeW91IGFyZSBsb29r aW5nIGZvci4pCg== From MAILER-DAEMON Tue Jan 29 03:00:07 2008 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1JJlO2-0003HN-UW for mharc-bug-bash@gnu.org; Tue, 29 Jan 2008 03:00:06 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JJlO1-0003Ge-D8 for bug-bash@gnu.org; Tue, 29 Jan 2008 03:00:05 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JJlNu-0003Dz-WA for bug-bash@gnu.org; Tue, 29 Jan 2008 03:00:04 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JJlNu-0003Dj-O5 for bug-bash@gnu.org; Tue, 29 Jan 2008 02:59:58 -0500 Received: from mx20.gnu.org ([199.232.41.8]) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1JJlNu-0006Ua-7B for bug-bash@gnu.org; Tue, 29 Jan 2008 02:59:58 -0500 Received: from [203.187.177.119] (helo=devsrv.otsc.com.cn) by mx20.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JJlNl-0005UH-MR for bug-bash@gnu.org; Tue, 29 Jan 2008 02:59:50 -0500 Received: from [192.168.0.7] (longhaitao [192.168.0.7]) by devsrv.otsc.com.cn (Postfix) with ESMTP id D98D2465F84; Tue, 29 Jan 2008 15:37:34 +0800 (CST) From: =?UTF-8?Q?=E9=BE=99=E6=B5=B7=E6=B6=9B?= To: Pierre Gaston In-Reply-To: References: <1201591941.4193.2.camel@localhost.localdomain> Content-Type: text/plain Organization: =?UTF-8?Q?=E5=8C=97=E4=BA=AC=E7=9F=A5=E6=97=B6=E5=8B=A4=E8=A1=8C?= =?UTF-8?Q?=E8=BD=AF=E4=BB=B6=E6=9C=89=E9=99=90=E5=85=AC=E5=8F=B8?= Date: Tue, 29 Jan 2008 15:42:07 +0800 Message-Id: <1201592527.4193.5.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Evolution 2.8.0 (2.8.0-7.fc6) Content-Transfer-Encoding: 7bit X-detected-kernel: by mx20.gnu.org: Linux 2.6 (newer, 3) X-Greylist: delayed 1638 seconds by postgrey-1.27 at nadesico; Tue, 29 Jan 2008 02:59:43 EST X-detected-kernel: by monty-python.gnu.org: Linux 2.6, seldom 2.4 (older, 4) Cc: yozh@mx1.ru, bug-bash@gnu.org, bash@packages.debian.org Subject: Re: -e does not work with subscript X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Jan 2008 08:00:05 -0000 > It has the same effect as set -e, you can pass the options of set to > bash directly bash -x etc... > got it. thanks > The manual says: > "In addition to the single-character shell options documented in the > description of the set builtin command, bash interprets the following > options when it is invoked:" > > (and don't worry for not finding it, I know it is easier to find what > you want when you already know what you are looking for.) From MAILER-DAEMON Tue Jan 29 03:05:02 2008 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1JJlSo-0005Ns-9F for mharc-bug-bash@gnu.org; Tue, 29 Jan 2008 03:05:02 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JJlSm-0005Ne-87 for bug-bash@gnu.org; Tue, 29 Jan 2008 03:05:00 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JJlSl-0005NL-M6 for bug-bash@gnu.org; Tue, 29 Jan 2008 03:04:59 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JJlSl-0005NI-FW for bug-bash@gnu.org; Tue, 29 Jan 2008 03:04:59 -0500 Received: from mx20.gnu.org ([199.232.41.8]) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1JJlSk-0007HP-Ou for bug-bash@gnu.org; Tue, 29 Jan 2008 03:04:58 -0500 Received: from ug-out-1314.google.com ([66.249.92.169]) by mx20.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JJlSi-0007Zi-0I for bug-bash@gnu.org; Tue, 29 Jan 2008 03:04:56 -0500 Received: by ug-out-1314.google.com with SMTP id a2so247376ugf.48 for ; Tue, 29 Jan 2008 00:04:49 -0800 (PST) Received: by 10.67.116.18 with SMTP id t18mr1116739ugm.85.1201593889176; Tue, 29 Jan 2008 00:04:49 -0800 (PST) Received: by 10.67.123.1 with HTTP; Tue, 29 Jan 2008 00:04:49 -0800 (PST) Message-ID: <7c1bea4b0801290004r2b2e5290j7967e770971790bd@mail.gmail.com> Date: Tue, 29 Jan 2008 11:04:49 +0300 From: "Stepan Koltsov" Sender: stepancheg@mx1.ru To: "Pierre Gaston" In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: X-Google-Sender-Auth: 97e5a7c6fb4f4a7f X-detected-kernel: by mx20.gnu.org: Linux 2.6 (newer, 2) X-detected-kernel: by monty-python.gnu.org: Linux 2.6, seldom 2.4 (older, 4) Cc: bug-bash@gnu.org, bash@packages.debian.org Subject: Re: -e does not work with subscript X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Jan 2008 08:05:00 -0000 On 1/29/08, Pierre Gaston wrote: > On Jan 28, 2008 11:36 PM, 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' -DCONF_VENDOR='pc' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash' -DSHELL -DHAVE_CONFIG_H -I. -I../bash -I../bash/include -I../bash/lib -g -O2 > > uname output: Linux hilbert 2.6.18-openvz-amd64 #1 SMP Tue Apr 10 19:34:07 MSD 2007 i686 GNU/Linux > > Machine Type: i486-pc-linux-gnu > > > > Bash Version: 3.1 > > Patch Level: 17 > > Release Status: release > > > > Description: > > failed subscript does not cause script to exit, while -e is set > > > > Repeat-By: > > > > % cat aa.sh > > set -e > > > > ( > > false > > ) > > > > echo "unreachable" > > > > % bash ./aa.sh > > unreachable > > % zsh ./aa.sh > > zsh: exit 1 zsh ./aa.sh > > > > Script aa.sh is expected to exit with error and print nothing. In bash it prints "unreachable". > > > > > bash exits the subshell you create with ( ) and not the shell: > > $ bash -ce '(false;echo foo);echo bar' > bar Bash must exit the shell too. Because $ bash -ce '(false); echo $?' 1 S. From MAILER-DAEMON Tue Jan 29 03:09:49 2008 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1JJlXR-0006nZ-Fa for mharc-bug-bash@gnu.org; Tue, 29 Jan 2008 03:09:49 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JJlXQ-0006nN-9M for bug-bash@gnu.org; Tue, 29 Jan 2008 03:09:48 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JJlXM-0006nA-8N for bug-bash@gnu.org; Tue, 29 Jan 2008 03:09:47 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JJlXM-0006n7-3q for bug-bash@gnu.org; Tue, 29 Jan 2008 03:09:44 -0500 Received: from mx20.gnu.org ([199.232.41.8]) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1JJlXL-0007sj-Gv for bug-bash@gnu.org; Tue, 29 Jan 2008 03:09:43 -0500 Received: from [203.187.177.119] (helo=devsrv.otsc.com.cn) by mx20.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JJlXK-0007wz-MR for bug-bash@gnu.org; Tue, 29 Jan 2008 03:09:43 -0500 Received: from [192.168.0.7] (longhaitao [192.168.0.7]) by devsrv.otsc.com.cn (Postfix) with ESMTP id DF896465F81; Tue, 29 Jan 2008 15:27:48 +0800 (CST) From: =?UTF-8?Q?=E9=BE=99=E6=B5=B7=E6=B6=9B?= To: Pierre Gaston In-Reply-To: References: Content-Type: text/plain Organization: =?UTF-8?Q?=E5=8C=97=E4=BA=AC=E7=9F=A5=E6=97=B6=E5=8B=A4=E8=A1=8C?= =?UTF-8?Q?=E8=BD=AF=E4=BB=B6=E6=9C=89=E9=99=90=E5=85=AC=E5=8F=B8?= Date: Tue, 29 Jan 2008 15:32:21 +0800 Message-Id: <1201591941.4193.2.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Evolution 2.8.0 (2.8.0-7.fc6) Content-Transfer-Encoding: 7bit X-detected-kernel: by mx20.gnu.org: Linux 2.6 (newer, 3) X-detected-kernel: by monty-python.gnu.org: Linux 2.6, seldom 2.4 (older, 4) Cc: yozh@mx1.ru, bug-bash@gnu.org, bash@packages.debian.org Subject: Re: -e does not work with subscript X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Jan 2008 08:09:48 -0000 > $ 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. PS: [root@localhost ~]# bash --version GNU bash, version 3.1.17(1)-release (x86_64-redhat-linux-gnu) Copyright (C) 2005 Free Software Foundation, Inc. > > From MAILER-DAEMON Tue Jan 29 03:10:19 2008 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1JJlXv-0006so-JH for mharc-bug-bash@gnu.org; Tue, 29 Jan 2008 03:10:19 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JJlXt-0006sR-Lw for bug-bash@gnu.org; Tue, 29 Jan 2008 03:10:17 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JJlXs-0006s6-AO for bug-bash@gnu.org; Tue, 29 Jan 2008 03:10:17 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JJlXr-0006s3-I7 for bug-bash@gnu.org; Tue, 29 Jan 2008 03:10:15 -0500 Received: from mx20.gnu.org ([199.232.41.8]) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1JJlXr-0007wt-23 for bug-bash@gnu.org; Tue, 29 Jan 2008 03:10:15 -0500 Received: from wx-out-0506.google.com ([66.249.82.238]) by mx20.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JJlXq-000802-5a for bug-bash@gnu.org; Tue, 29 Jan 2008 03:10:14 -0500 Received: by wx-out-0506.google.com with SMTP id s7so1579122wxc.24 for ; Tue, 29 Jan 2008 00:10:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; bh=MnH9sqsJ//dg5Aw/DKZ1+HQZUhLF92SQ2RkyG9Ao8UI=; b=Kx3pBT8sleoJwV5FmKt3ZV2Xk9lE5BAqMXG+B/3ppQaK2AIiXcg7PA5IxpN0hdmJ3H3dEXYLZ8FnRZWEJSreja8CbZbqvdfOJcw9wwqR6eI3KTdXefJES7dH5j3iV/LRCwfpzHICK5ZS4utQ3Q434kaujeR70bHzlweMKzksH3Q= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=UGA9rJYtFD/3SmMu0fl2o3zsBdHN/0ZOrJQUweIcTm0Kp0CKuE8FZe+zYed5RVAtKYXCGugd0EHw0dHb60b5KhgPn0VT/OZi4FHf6NNEa/8fQYdp9xptK2VBZI/ubOIASowAmNouGm81tTqkYdR91ZFSW/sEFJipkkvsKybG4KI= Received: by 10.150.54.6 with SMTP id c6mr2571424yba.77.1201594213254; Tue, 29 Jan 2008 00:10:13 -0800 (PST) Received: by 10.150.146.15 with HTTP; Tue, 29 Jan 2008 00:10:13 -0800 (PST) Message-ID: Date: Tue, 29 Jan 2008 10:10:13 +0200 From: "Pierre Gaston" To: "Stepan Koltsov" In-Reply-To: <7c1bea4b0801290004r2b2e5290j7967e770971790bd@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <7c1bea4b0801290004r2b2e5290j7967e770971790bd@mail.gmail.com> X-detected-kernel: by mx20.gnu.org: Linux 2.6 (newer, 2) X-detected-kernel: by monty-python.gnu.org: Linux 2.6, seldom 2.4 (older, 4) Cc: bug-bash@gnu.org, bash@packages.debian.org Subject: Re: -e does not work with subscript X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Jan 2008 08:10:18 -0000 On Jan 29, 2008 10:04 AM, Stepan Koltsov 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 From MAILER-DAEMON Tue Jan 29 09:31:55 2008 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1JJrVD-0003Bh-B0 for mharc-bug-bash@gnu.org; Tue, 29 Jan 2008 09:31:55 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JJrVC-0003BJ-2Q for bug-bash@gnu.org; Tue, 29 Jan 2008 09:31:54 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JJrVB-0003Az-Kt for bug-bash@gnu.org; Tue, 29 Jan 2008 09:31:53 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JJrVB-0003Aw-Gu for bug-bash@gnu.org; Tue, 29 Jan 2008 09:31:53 -0500 Received: from qmta03.emeryville.ca.mail.comcast.net ([76.96.30.32]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JJrVB-0000xV-20 for bug-bash@gnu.org; Tue, 29 Jan 2008 09:31:53 -0500 Received: from OMTA05.emeryville.ca.mail.comcast.net ([76.96.30.43]) by QMTA03.emeryville.ca.mail.comcast.net with comcast id j2111Y00C0vp7WL0A04G00; Tue, 29 Jan 2008 14:31:52 +0000 Received: from [192.168.0.103] ([67.166.125.73]) by OMTA05.emeryville.ca.mail.comcast.net with comcast id j2XZ1Y0031b8C2B8R00000; Tue, 29 Jan 2008 14:31:52 +0000 X-Authority-Analysis: v=1.0 c=1 a=xe8BsctaAAAA:8 a=skDZaBeCJv6_Cm-WEfcA:9 a=rZ0HZNsvf4u64_gG9ZMA:7 a=qx2yShjRHJzvTfVOJMHxSY4siNEA:4 a=eDFNAWYWrCwA:10 a=rPt6xJ-oxjAA:10 Message-ID: <479F38C8.9060707@byu.net> Date: Tue, 29 Jan 2008 07:31:36 -0700 From: Eric Blake User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.9) Gecko/20071031 Thunderbird/2.0.0.9 Mnenhy/0.7.5.666 MIME-Version: 1.0 To: Paolo Bonzini References: <479BF658.4090007@byu.net> <87bq77t841.fsf@penguin.cs.ucla.edu> <479DE192.7010800@byu.net> <20080128203739.GA553@ins.uni-bonn.de> <479E4029.9010404@byu.net> <20080128205537.GD553@ins.uni-bonn.de> <479E42AD.7020106@gnu.org> <479EBF98.5070609@byu.net> <479EC358.2090806@gnu.org> <479F2F41.8060108@byu.net> <479F35E3.4080303@gnu.org> In-Reply-To: <479F35E3.4080303@gnu.org> X-Enigmail-Version: 0.95.6 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-detected-kernel: by monty-python.gnu.org: Genre and OS details not recognized. Cc: Autoconf Patches List , bug-bash Subject: Re: testsuite -C dir X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Jan 2008 14:31:54 -0000 -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 According to Paolo Bonzini on 1/29/2008 7:19 AM: |> | I didn't know source used the path. Actually I thought the contrary... |> |> . has always used PATH; but in older shells, it also implicitly tacked . |> onto its path search. Since this was a security hole for trojan files, |> POSIX forbids implicit `.'. Thus, the only safe way to source a file in |> the current directory is with anchored notation, since you can't rely on |> `.' being in the user's PATH. | | Uhm, I have: | | bonzinip$ echo echo foo > bar | bonzinip$ . bar | foo | | And . is not in the PATH: | | bonzinip$ chmod +x bar | bonzinip$ bar | -bash: bar: command not found | | Then I try within scripts and behavior is the same: | | bonzinip$ echo . bar > baz | bonzinip$ chmod +x baz | bonzinip$ sh --version | GNU bash, version 2.05b.0(1)-release (powerpc-apple-darwin8.0) | bonzinip$ ./baz | foo | bonzinip$ POSIXLY_CORRECT=1 sh baz | foo | | Even with bash 3.2: | | bonzinip$ /sw/bin/bash --version | GNU bash, version 3.2.9(1)-release (powerpc-apple-darwin8.10.0) | Copyright (C) 2005 Free Software Foundation, Inc. | bonzinip$ /sw/bin/bash baz | foo | bonzinip$ POSIXLY_CORRECT=1 /sw/bin/bash baz | foo | | /me is confused... Hmm. Bash explicitly documents that it behaves differently depending on whether it is in POSIX mode - from bash-3.2/POSIX: ~ 28. The `.' and `source' builtins do not search the current directory ~ for the filename argument if it is not found by searching `PATH'. It looks like we've discovered a bash bug. - -- Don't work too hard, make some time for fun as well! Eric Blake ebb9@byu.net -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.5 (Cygwin) Comment: Public key at home.comcast.net/~ericblake/eblake.gpg Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFHnzjH84KuGfSFAYARAiEUAJ9daSG5G7xXlPGyW0i88zu02zznqwCfdOMP nKPxBGFPgh33k14nVZT8Kbg= =KoSc -----END PGP SIGNATURE----- From MAILER-DAEMON Tue Jan 29 13:09:24 2008 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1JJutf-0005zc-UX for mharc-bug-bash@gnu.org; Tue, 29 Jan 2008 13:09:23 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JJute-0005yi-DQ for bug-bash@gnu.org; Tue, 29 Jan 2008 13:09:22 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JJutd-0005yE-2G for bug-bash@gnu.org; Tue, 29 Jan 2008 13:09:21 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JJutc-0005xz-JN for bug-bash@gnu.org; Tue, 29 Jan 2008 13:09:20 -0500 Received: from ug-out-1314.google.com ([66.249.92.174]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JJutc-0007EF-5f for bug-bash@gnu.org; Tue, 29 Jan 2008 13:09:20 -0500 Received: by ug-out-1314.google.com with SMTP id a2so349193ugf.48 for ; Tue, 29 Jan 2008 10:09:19 -0800 (PST) Received: by 10.66.221.17 with SMTP id t17mr1706116ugg.66.1201630158649; Tue, 29 Jan 2008 10:09:18 -0800 (PST) Received: by 10.67.123.1 with HTTP; Tue, 29 Jan 2008 10:09:18 -0800 (PST) Message-ID: <7c1bea4b0801291009u51f3d4cckad6ab9879304ecdc@mail.gmail.com> Date: Tue, 29 Jan 2008 21:09:18 +0300 From: "Stepan Koltsov" Sender: stepancheg@mx1.ru To: "Pierre Gaston" In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <7c1bea4b0801290004r2b2e5290j7967e770971790bd@mail.gmail.com> X-Google-Sender-Auth: 033af37106adfb30 X-detected-kernel: by monty-python.gnu.org: Linux 2.6 (newer, 2) Cc: bug-bash@gnu.org, bash@packages.debian.org Subject: Re: -e does not work with subscript X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Jan 2008 18:09:22 -0000 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. S. On 1/29/08, Pierre Gaston wrote: > On Jan 29, 2008 10:04 AM, Stepan Koltsov 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 > From MAILER-DAEMON Tue Jan 29 13:12:16 2008 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1JJuwS-0007Su-KF for mharc-bug-bash@gnu.org; Tue, 29 Jan 2008 13:12:16 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JJuwQ-0007Pw-4s for bug-bash@gnu.org; Tue, 29 Jan 2008 13:12:14 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JJuwO-0007Nc-K8 for bug-bash@gnu.org; Tue, 29 Jan 2008 13:12:13 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JJuwO-0007NJ-9F for bug-bash@gnu.org; Tue, 29 Jan 2008 13:12:12 -0500 Received: from ishtar.tlinx.org ([64.81.245.74]) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1JJuwN-0007YN-Oe for bug-bash@gnu.org; Tue, 29 Jan 2008 13:12:12 -0500 Received: from [192.168.3.11] (Athena [192.168.3.11]) by ishtar.tlinx.org (8.13.3/8.12.10/SuSE Linux 0.7) with ESMTP id m0TIA0YO003272; Tue, 29 Jan 2008 10:10:00 -0800 Message-ID: <479F6BF8.2030403@tlinx.org> Date: Tue, 29 Jan 2008 10:10:00 -0800 From: Linda Walsh User-Agent: Thunderbird 2.0.0.9 (Windows/20071031) MIME-Version: 1.0 To: Linda Walsh , abi@e-arroyo.net, bug-bash@gnu.org References: <20129.75.37.15.205.1201442587.squirrel@www.e-arroyo.net> <479D2100.1050106@tlinx.org> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-detected-kernel: by monty-python.gnu.org: Linux 2.6 (newer, 2) Cc: Subject: Re: Exit application with two function calls X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Jan 2008 18:12:14 -0000 Paul Jarc wrote: > Linda Walsh wrote: >> # *1 - using "-e" stops your script immediately on any error > > Not any error - only those from simple commands. The subtleties are > subtle enough that I avoid -e, and use "&&" between all commands > instead. > > paul ---- Yeah...it doesn't catch everything -- probably not best for a production script, but I always use it as "-ue". That catches many more -- mispelled or unset vars also cause an errexit. It depends on how you program -- if you use && and || alot, it will "hide" a failure status, but presumably, if you are using || or ||, you are catching the error condition yourself...? I'll often use (cd dir && do-something-I-only-want-done-in-dir).... Using a pathological example: cd /temp; rm -fr * # not likely intended if one meant # /tmp instead of /temp... :-), but cd /tmp && rm -fr * is slightly safer... I thought && and || were specifically listed as ways to avoid a command failure (so -e wouldn't trigger an exit)... Maybe that was in some other shell reference I read. From MAILER-DAEMON Tue Jan 29 13:20:42 2008 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1JJv4c-0001vR-J1 for mharc-bug-bash@gnu.org; Tue, 29 Jan 2008 13:20:42 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JJv4b-0001v6-Os for bug-bash@gnu.org; Tue, 29 Jan 2008 13:20:41 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JJv4Z-0001si-Iv for bug-bash@gnu.org; Tue, 29 Jan 2008 13:20:41 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JJv4Z-0001sS-9t for bug-bash@gnu.org; Tue, 29 Jan 2008 13:20:39 -0500 Received: from ishtar.tlinx.org ([64.81.245.74]) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1JJv4Y-00023L-Pq for bug-bash@gnu.org; Tue, 29 Jan 2008 13:20:39 -0500 Received: from [192.168.3.11] (Athena [192.168.3.11]) by ishtar.tlinx.org (8.13.3/8.12.10/SuSE Linux 0.7) with ESMTP id m0TIKaEK003396; Tue, 29 Jan 2008 10:20:36 -0800 Message-ID: <479F6E75.5090801@tlinx.org> Date: Tue, 29 Jan 2008 10:20:37 -0800 From: Linda Walsh User-Agent: Thunderbird 2.0.0.9 (Windows/20071031) MIME-Version: 1.0 To: bug-bash@gnu.org References: <479D3740.6080406@tlinx.org> <479DFFD6.3020005@sudrala.de> In-Reply-To: <479DFFD6.3020005@sudrala.de> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-detected-kernel: by monty-python.gnu.org: Linux 2.6 (newer, 2) Cc: monoped@sudrala.de Subject: Re: capturing sub-expressions? X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Jan 2008 18:20:41 -0000 Bernd Eggink wrote: > Linda Walsh schrieb: >> I keep confusing the path-matching regular expressions with >> string-matching expressions and keep getting disappointed when I'm >> re-reminded of the limitation...:-( > > There should be no difference between path-matching and string-matching > expressions. Normally even nested extended patterns work with string > matching. But, in fact, !(...) appears to not work like one would > expect. The only case that looked correct to me is the trivial one > ${x//!(*)}, which leaves $x unchanged. > > I'm not sure whether this is a bug or I (we) miss something. > Interestingly, ksh behaves the same way. Can anybody clarify this? --- Perhaps due to other failures, I haven't always had luck in the with the *() !() ops due to quirk in the way they work... Reading in the manpage, the section ordering is minorly confusing at first glance... Parameter Expansion Command Substitution Arithmetic Expansion Process Substitution Word Splitting Pathname Expansion Pattern Matching Quote Removal .... ----- In my copy of the man pages, Pattern matching is indented an extra level making it look like it's under Pathname Expansion and only applies there....but if people say it works outside of Paths... well...must be so! :-)...darn manpages! You are right about the !() not working as one would expect... I thought: p="myswitch1 myswitch2 myswitch3" then p=${p/!(myswitch2)} I _hoped_ would match every thing in "p" except "myswitch2", i.e. "myswitch1 myswitch3", which (guess I didn't think this through too well) I wanted to leave "myswitch2" as the only thing left in $p; A bit too creative with my pattern matching. Hey...whatever happened to the "Do what I want" operator??? From MAILER-DAEMON Tue Jan 29 13:36:00 2008 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1JJvJQ-000093-Pj for mharc-bug-bash@gnu.org; Tue, 29 Jan 2008 13:36:00 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JJvJP-00008U-1i for bug-bash@gnu.org; Tue, 29 Jan 2008 13:35:59 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JJvJN-00008E-M3 for bug-bash@gnu.org; Tue, 29 Jan 2008 13:35:58 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JJvJN-000089-Df for bug-bash@gnu.org; Tue, 29 Jan 2008 13:35:57 -0500 Received: from ishtar.tlinx.org ([64.81.245.74]) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1JJvJM-0005T5-Ps for bug-bash@gnu.org; Tue, 29 Jan 2008 13:35:57 -0500 Received: from [192.168.3.11] (Athena [192.168.3.11]) by ishtar.tlinx.org (8.13.3/8.12.10/SuSE Linux 0.7) with ESMTP id m0TIZpDj003540; Tue, 29 Jan 2008 10:35:52 -0800 Message-ID: <479F7207.4080306@tlinx.org> Date: Tue, 29 Jan 2008 10:35:51 -0800 From: Linda Walsh User-Agent: Thunderbird 2.0.0.9 (Windows/20071031) MIME-Version: 1.0 To: =?UTF-8?B?IkNoZW4ow6kpIEp1bijDpSki?= References: <479D6FA6.1050100@gmail.com> <479DD6E0.7060701@byu.net> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable X-detected-kernel: by monty-python.gnu.org: Linux 2.6 (newer, 2) Cc: bug-bash@gnu.org Subject: Re: Is there a Windows native port of Bash or Bourne Shell(no cygwin)? X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Jan 2008 18:35:59 -0000 Chen(=C3=A9) Jun(=C3=A5) wrote: > sh -c "pwd"=20 > It outputs:=20 > /bin=20 > Oouups, what I expect was E:/msys/1.0/bin . > Suprised? You now know what the weird sh.exe does. It checks whether so= me > token starts with / , if so, it considers that toke a path and applies > trasformation. This is utterly rude. So this sh.exe cannot cooperate wi= th > many existing Windows programs. --- It was deliberately designed that way by Bill Gates!!! "/" was used by CP/M on microcomputers -- I think they copied the idea from early versions (Bell Labs) of Unix. Bill Gates made the path separator "\" to make DOS distinctively different from CP/M, to try to avoid accusations of copying CP/M's interface. Dunno if he told DOS's creator to write it that way or if he changed it in the code after he purchased it and before he licensed it to IBM, but either way -- "\" has been an albatross around DOS's / Window's neck ever since. At the time, it wasn't so much of an issue. "C" wasn't ported to DOS at the time and neither were the unix utils, so the fact that "\" is almost universally a "quote-next-char-as-literal" wasn't so much an issue. But now...programming anything in Windows is a "drag" due to Bill Gates trying to hide Dos's similarities from CP/M. Idiot. At least with Cygwin, you can somewhat control unix or dos path conversion with "cygpath" which can convert paths either way. I just wish cygwin's "system" features would integrate better with windows...(things like being able to use kill to kill windows processes, or kill -SIGSTOP" to suspend them, for example...). I use bash as a windows scripting language -- if I need to pass something as a Windows path, I can use cygpath or single quotes to literallize the string... I call bash scripts from the task-scheduler, nightly, to do Windows maintenance... From MAILER-DAEMON Tue Jan 29 13:41:52 2008 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1JJvP5-00024L-Ql for mharc-bug-bash@gnu.org; Tue, 29 Jan 2008 13:41:51 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JJvP4-00024F-8w for bug-bash@gnu.org; Tue, 29 Jan 2008 13:41:50 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JJvP1-000243-Qg for bug-bash@gnu.org; Tue, 29 Jan 2008 13:41:49 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JJvP1-00023v-M8 for bug-bash@gnu.org; Tue, 29 Jan 2008 13:41:47 -0500 Received: from mpv4.tis.cwru.edu ([129.22.105.34]) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_3DES_EDE_CBC_SHA1:24) (Exim 4.60) (envelope-from ) id 1JJvP1-0006Zm-Cp for bug-bash@gnu.org; Tue, 29 Jan 2008 13:41:47 -0500 Received: from mpv5.TIS.cwru.edu (mpv5.tis.CWRU.Edu [129.22.105.51]) by mpv4.tis.cwru.edu (MOS 3.8.6-GA) with ESMTP id CHB00490 for ; Tue, 29 Jan 2008 13:41:19 -0500 (EST) Received: from multivac.cwru.edu (multivac.its.CWRU.Edu [129.22.114.26]) by mpv5.TIS.cwru.edu (MOS 3.8.6-GA) with SMTP id DWH13762 for ; Tue, 29 Jan 2008 13:41:18 -0500 (EST) Received: (qmail 20898 invoked by uid 500); 29 Jan 2008 18:41:40 -0000 To: Linda Walsh In-Reply-To: <479F6E75.5090801@tlinx.org> (Linda Walsh's message of "Tue\, 29 Jan 2008 10\:20\:37 -0800") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1 (gnu/linux) References: <479D3740.6080406@tlinx.org> <479DFFD6.3020005@sudrala.de> <479F6E75.5090801@tlinx.org> From: prj@po.cwru.edu (Paul Jarc) Organization: What did you have in mind? A short, blunt, human pyramid? Mail-Copies-To: nobody Mail-Followup-To: Linda Walsh , bug-bash@gnu.org, monoped@sudrala.de Date: Tue, 29 Jan 2008 13:41:13 -0500 Message-ID: Lines: 21 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Junkmail-Status: score=10/49, host=mpv4.tis.cwru.edu X-Junkmail-SD-Raw: score=unknown, refid=str=0001.0A090208.479F734F.0138,ss=1,fgs=0, ip=129.22.105.51, so=2007-10-30 19:00:17, dmn=5.4.3/2007-11-16 X-Junkmail-IWF: false X-detected-kernel: by monty-python.gnu.org: Genre and OS details not recognized. Cc: bug-bash@gnu.org, monoped@sudrala.de Subject: Re: capturing sub-expressions? X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Jan 2008 18:41:50 -0000 Linda Walsh wrote: > In my copy of the man pages, Pattern matching is indented an extra > level making it look like it's under Pathname Expansion and only > applies there.... Pattern matching applies primarily to pathname expansion; other uses explicitly refer to its use there: ${parameter/pattern/string} The pattern is expanded to produce a pattern just as in pathname expansion. Parameter is expanded and the longest match of pattern against its value is replaced with string. [...] > I wanted to leave "myswitch2" as the only thing left in $p; p=" $p " p=${p/* myswitch2 */myswitch} p=${p/ */} paul From MAILER-DAEMON Tue Jan 29 14:24:20 2008 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1JJw4C-00084A-Da for mharc-bug-bash@gnu.org; Tue, 29 Jan 2008 14:24:20 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JJw4A-000843-6y for bug-bash@gnu.org; Tue, 29 Jan 2008 14:24:18 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JJw48-00083r-LK for bug-bash@gnu.org; Tue, 29 Jan 2008 14:24:17 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JJw48-00083o-Hp for bug-bash@gnu.org; Tue, 29 Jan 2008 14:24:16 -0500 Received: from py-out-1112.google.com ([64.233.166.182]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JJw48-0006yP-CL for bug-bash@gnu.org; Tue, 29 Jan 2008 14:24:16 -0500 Received: by py-out-1112.google.com with SMTP id u52so2462724pyb.1 for ; Tue, 29 Jan 2008 11:24:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; bh=B+Qo+CBPg1ALrZlisfsfAT/HjhcyOCeo4EHsLtqVe00=; b=Mt9128xN7o1xGQQFB3tSI7VYSYP+4Q/hol3L6zJDCR+pFcwpE66gVZo2A6iSqy16Rwa+eDkNPLDzzcl9mUc3GXK3nTRlH+qjsAttl+vB+Kth14sM+eD+5nMgWf/unkJ/ELmUd68r9o7+TMfI5HRUmGAfRXLotrhOap6jZ+ixJFw= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=JY/Eo14rhCJO81cFaAWqw+wEVgVygaTJJV2T9fM5QL8rV/679ECFuL/aVzHOhNeghGJl/e3X0CSQHEmdJ6jFKTt7FBeJZ5XhQBjnHX7BpTJftqa5tFKFvwF2K5xDXrr1cBVFnwa8DUVRbo0oDYyzE/m2+ZbeloI/VT/8YFN62dk= Received: by 10.65.96.6 with SMTP id y6mr15150245qbl.24.1201634655409; Tue, 29 Jan 2008 11:24:15 -0800 (PST) Received: by 10.64.178.15 with HTTP; Tue, 29 Jan 2008 11:24:15 -0800 (PST) Message-ID: Date: Tue, 29 Jan 2008 21:24:15 +0200 From: "Pierre Gaston" To: "Stepan Koltsov" In-Reply-To: <7c1bea4b0801291009u51f3d4cckad6ab9879304ecdc@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <7c1bea4b0801290004r2b2e5290j7967e770971790bd@mail.gmail.com> <7c1bea4b0801291009u51f3d4cckad6ab9879304ecdc@mail.gmail.com> X-detected-kernel: by monty-python.gnu.org: Linux 2.6 (newer, 2) Cc: bug-bash@gnu.org, bash@packages.debian.org Subject: Re: -e does not work with subscript X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Jan 2008 19:24:18 -0000 On Jan 29, 2008 8:09 PM, Stepan Koltsov 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 to man bash, this is a list It is perhaps possible to consider that the last false is executed as a simple command but I think the documentation of set -e could perhaps be made more clear about what happens when the last command of a list exits with non 0. I understand why it is implemented this way, so that any non processed error exits the shell. The shells seems to disagree on what (false) should do (ksh and zsh exit the shell, dash and bash only the subshell. They also seems to disagree on what ! true should do ( zsh exits, bash dash and ksh don't) From MAILER-DAEMON Tue Jan 29 14:29:27 2008 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1JJw98-0001rF-Vo for mharc-bug-bash@gnu.org; Tue, 29 Jan 2008 14:29:27 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JJw96-0001qb-VI for bug-bash@gnu.org; Tue, 29 Jan 2008 14:29:25 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JJw94-0001qG-IG for bug-bash@gnu.org; Tue, 29 Jan 2008 14:29:24 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JJw94-0001qD-Cv for bug-bash@gnu.org; Tue, 29 Jan 2008 14:29:22 -0500 Received: from mailout11.sul.t-online.de ([194.25.134.85] helo=mailout11.sul.t-online.com) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JJw94-0007rW-2d for bug-bash@gnu.org; Tue, 29 Jan 2008 14:29:22 -0500 Received: from fwd28.aul.t-online.de by mailout11.sul.t-online.com with smtp id 1JJw8y-0008D6-00; Tue, 29 Jan 2008 20:29:16 +0100 Received: from mail.home.thebonsai.de (GM6euaZ6Qht6hP9+vmyHGcZk9yvShh9aG4I09DYqtoNkcYE+S042RtaKPFHLNdggMn@[84.147.70.61]) by fwd28.aul.t-online.de with esmtp id 1JJw7v-1w6WPY0; Tue, 29 Jan 2008 20:28:11 +0100 Received: from [192.168.64.3] (mainserver.home.thebonsai.de [192.168.64.3]) by mail.home.thebonsai.de (Postfix) with ESMTP id 0C16B6B146; Tue, 29 Jan 2008 20:28:08 +0100 (CET) Message-ID: <479F7E46.5000402@web.de> Date: Tue, 29 Jan 2008 20:28:06 +0100 From: Jan Schampera User-Agent: IceDove 1.5.0.14pre (X11/20071018) MIME-Version: 1.0 Newsgroups: gnu.bash.bug To: Lea Wiemann References: In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-ID: GM6euaZ6Qht6hP9+vmyHGcZk9yvShh9aG4I09DYqtoNkcYE+S042RtaKPFHLNdggMn@t-dialin.net X-TOI-MSGID: 164d158c-4ace-464e-b2c5-c935f82e0752 X-detected-kernel: by monty-python.gnu.org: Linux 2.6 (newer, 3) Cc: bug-bash@gnu.org, bash@packages.debian.org Subject: Re: Sub-arrays do not work with non-blank IFS X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Jan 2008 19:29:25 -0000 Lea Wiemann 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' > -DCONF_VENDOR='pc' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash' > -DSHELL -DHAVE_CONFIG_H -I. -I../bash -I../bash/include -I../bash/lib > -g -O2 > uname output: Linux fly 2.6.22-3-686 #1 SMP Mon Nov 12 08:32:57 UTC 2007 > i686 GNU/Linux > Machine Type: i486-pc-linux-gnu > > Bash Version: 3.1 > Patch Level: 17 > Release Status: release > > Description: > > If the IFS does not contain a blank, copying an array using > ("${array[@]}") works, but creating a sub-array using > ("${array[@]:offset:length}") does not work. > > Repeat-By: > > IFS=$'\n' > a=(A B C D) > b=("${a[@]}") > echo "${#b[@]}", "${b[@]}" # 4, A B C D -- OK > b=("${a[@]:2}") > echo "${#b[@]}", "${b[@]}" # 1, C D -- bug, should be 2, C D I assume: "${array[@]}" is defined (see manual) to expand as separate words. "${array[@]:x:y}" will "just expand" >From my understanding this is the correct behaviour. J. From MAILER-DAEMON Tue Jan 29 14:34:50 2008 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1JJwEL-00044r-U2 for mharc-bug-bash@gnu.org; Tue, 29 Jan 2008 14:34:50 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JJwEJ-00044X-Rg for bug-bash@gnu.org; Tue, 29 Jan 2008 14:34:47 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JJwEG-00041R-7B for bug-bash@gnu.org; Tue, 29 Jan 2008 14:34:47 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JJwEG-00041I-2n for bug-bash@gnu.org; Tue, 29 Jan 2008 14:34:44 -0500 Received: from mailout03.sul.t-online.de ([194.25.134.81] helo=mailout03.sul.t-online.com) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JJwEF-0000Yr-Ps for bug-bash@gnu.org; Tue, 29 Jan 2008 14:34:44 -0500 Received: from fwd28.aul.t-online.de by mailout03.sul.t-online.com with smtp id 1JJwED-000427-03; Tue, 29 Jan 2008 20:34:41 +0100 Received: from mail.home.thebonsai.de (r3H-SoZV8hs9at9hUeNXDQY58f9v5pG6daqXCgC3IE3Va0byhI5BcKpg+N6JVwZg4X@[84.147.70.61]) by fwd28.aul.t-online.de with esmtp id 1JJwD8-0Ana5Y0; Tue, 29 Jan 2008 20:33:34 +0100 Received: from [192.168.64.3] (mainserver.home.thebonsai.de [192.168.64.3]) by mail.home.thebonsai.de (Postfix) with ESMTP id AAA026B146; Tue, 29 Jan 2008 20:33:32 +0100 (CET) Message-ID: <479F7F8A.4090309@web.de> Date: Tue, 29 Jan 2008 20:33:30 +0100 From: Jan Schampera User-Agent: IceDove 1.5.0.14pre (X11/20071018) MIME-Version: 1.0 Newsgroups: gnu.bash.bug To: Lea Wiemann References: In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-ID: r3H-SoZV8hs9at9hUeNXDQY58f9v5pG6daqXCgC3IE3Va0byhI5BcKpg+N6JVwZg4X@t-dialin.net X-TOI-MSGID: b18e51b5-e769-4910-b466-6a54b3f09955 X-detected-kernel: by monty-python.gnu.org: Linux 2.6 (newer, 3) Cc: bug-bash@gnu.org, bash@packages.debian.org Subject: Re: Sub-arrays do not work with non-blank IFS X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Jan 2008 19:34:48 -0000 Lea Wiemann wrote: > Repeat-By: > > IFS=$'\n' > a=(A B C D) > b=("${a[@]}") > echo "${#b[@]}", "${b[@]}" # 4, A B C D -- OK > b=("${a[@]:2}") > echo "${#b[@]}", "${b[@]}" # 1, C D -- bug, should be 2, C D I have to correct myself, in the normal case "${a[@]:2}" will expand indeed word-wise. So it's a bug. Sorry, Jan From MAILER-DAEMON Tue Jan 29 14:41:26 2008 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1JJwKk-0006jD-6i for mharc-bug-bash@gnu.org; Tue, 29 Jan 2008 14:41:26 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JJwKi-0006iZ-9S for bug-bash@gnu.org; Tue, 29 Jan 2008 14:41:24 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JJwKf-0006hH-8U for bug-bash@gnu.org; Tue, 29 Jan 2008 14:41:23 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JJwKe-0006h4-V5 for bug-bash@gnu.org; Tue, 29 Jan 2008 14:41:20 -0500 Received: from ug-out-1314.google.com ([66.249.92.169]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JJwKe-0001ys-LB for bug-bash@gnu.org; Tue, 29 Jan 2008 14:41:20 -0500 Received: by ug-out-1314.google.com with SMTP id a2so370160ugf.48 for ; Tue, 29 Jan 2008 11:41:17 -0800 (PST) Received: by 10.66.239.16 with SMTP id m16mr1842675ugh.11.1201635676315; Tue, 29 Jan 2008 11:41:16 -0800 (PST) Received: by 10.67.123.1 with HTTP; Tue, 29 Jan 2008 11:41:16 -0800 (PST) Message-ID: <7c1bea4b0801291141gf686665t5f1881056e094255@mail.gmail.com> Date: Tue, 29 Jan 2008 22:41:16 +0300 From: "Stepan Koltsov" Sender: stepancheg@mx1.ru To: "Pierre Gaston" In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <7c1bea4b0801290004r2b2e5290j7967e770971790bd@mail.gmail.com> <7c1bea4b0801291009u51f3d4cckad6ab9879304ecdc@mail.gmail.com> X-Google-Sender-Auth: 7a7a7e252a6563d4 X-detected-kernel: by monty-python.gnu.org: Linux 2.6 (newer, 2) Cc: bug-bash@gnu.org, bash@packages.debian.org Subject: Re: -e does not work with subscript X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Jan 2008 19:41:24 -0000 BTW, my use case for "(false)" is: === set -e ( cd some-dir && make ) ( cd other-dir && ./build.sh ) ( cd third-dir && ant ) === Most readers (and writers) expect script to fail if "make" failed. So I think that outer bash should exit with error on "(false)" :-) Of course, script can be rewritten as === ( cd some-dir && make ) || false === S. On 1/29/08, Pierre Gaston wrote: > On Jan 29, 2008 8:09 PM, Stepan Koltsov 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 to man bash, this is a list It is perhaps possible to > consider that the last false is executed as a simple > command but I think the documentation of set -e could perhaps be made > more clear about what happens when > the last command of a list exits with non 0. > > I understand why it is implemented this way, so that any non processed > error exits the shell. > > The shells seems to disagree on what (false) should do (ksh and zsh > exit the shell, dash and bash only the subshell. > They also seems to disagree on what ! true should do ( zsh exits, bash > dash and ksh don't) > From MAILER-DAEMON Tue Jan 29 16:16:46 2008 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1JJxp0-00045A-AA for mharc-bug-bash@gnu.org; Tue, 29 Jan 2008 16:16:46 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JJxoy-00043P-Nl for bug-bash@gnu.org; Tue, 29 Jan 2008 16:16:44 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JJxox-00041b-Aq for bug-bash@gnu.org; Tue, 29 Jan 2008 16:16:44 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JJxox-00041R-3A for bug-bash@gnu.org; Tue, 29 Jan 2008 16:16:43 -0500 Received: from joseki.proulx.com ([216.17.153.58]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JJxox-0006bg-3X for bug-bash@gnu.org; Tue, 29 Jan 2008 16:16:43 -0500 Received: from dementia.proulx.com (dementia.proulx.com [192.168.1.115]) by joseki.proulx.com (Postfix) with ESMTP id 607F7FA5B; Tue, 29 Jan 2008 14:16:42 -0700 (MST) Received: by dementia.proulx.com (Postfix, from userid 1000) id 0623B3CC74E; Tue, 29 Jan 2008 14:16:42 -0700 (MST) Date: Tue, 29 Jan 2008 14:16:42 -0700 To: Stepan Koltsov Message-ID: <20080129211641.GA11365@dementia.proulx.com> Mail-Followup-To: Stepan Koltsov , Pierre Gaston , bug-bash@gnu.org, bash@packages.debian.org References: <7c1bea4b0801290004r2b2e5290j7967e770971790bd@mail.gmail.com> <7c1bea4b0801291009u51f3d4cckad6ab9879304ecdc@mail.gmail.com> <7c1bea4b0801291141gf686665t5f1881056e094255@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <7c1bea4b0801291141gf686665t5f1881056e094255@mail.gmail.com> User-Agent: Mutt/1.5.13 (2006-08-11) From: bob@proulx.com (Bob Proulx) X-detected-kernel: by monty-python.gnu.org: Genre and OS details not recognized. Cc: Pierre Gaston , bash@packages.debian.org, bug-bash@gnu.org Subject: Re: -e does not work with subscript X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Jan 2008 21:16:45 -0000 Stepan Koltsov wrote: > set -e > ( cd some-dir && make ) > ... > Most readers (and writers) expect script to fail if "make" failed. So > I think that outer bash should exit with error on "(false)" :-) > Of course, script can be rewritten as > ( cd some-dir && make ) || false Of course the script can also be written as: make -C some-dir :-) Bob From MAILER-DAEMON Tue Jan 29 16:20:31 2008 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1JJxsc-0005Nt-Vt for mharc-bug-bash@gnu.org; Tue, 29 Jan 2008 16:20:30 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JJxsb-0005NH-QN for bug-bash@gnu.org; Tue, 29 Jan 2008 16:20:29 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JJxsa-0005ME-8d for bug-bash@gnu.org; Tue, 29 Jan 2008 16:20:29 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JJxsa-0005MB-3T for bug-bash@gnu.org; Tue, 29 Jan 2008 16:20:28 -0500 Received: from m2.goneo.de ([82.100.220.83]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JJxsZ-0007Q7-V7 for bug-bash@gnu.org; Tue, 29 Jan 2008 16:20:28 -0500 Received: from localhost (localhost.goneo.de [127.0.0.1]) by scan.goneo.de (Postfix) with ESMTP id CAE13130C21; Tue, 29 Jan 2008 22:20:25 +0100 (CET) Received: from m2.goneo.de ([127.0.0.1]) by localhost (m2.goneo.de [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 11460-01-9; Tue, 29 Jan 2008 22:20:10 +0100 (CET) Received: from [192.168.178.2] (d028186.adsl.hansenet.de [80.171.28.186]) by m2-smtp.goneo.de (Postfix) with ESMTP id 37F05130CA3; Tue, 29 Jan 2008 22:20:08 +0100 (CET) Message-ID: <479F9888.1040403@sudrala.de> Date: Tue, 29 Jan 2008 22:20:08 +0100 From: Bernd Eggink User-Agent: Thunderbird 2.0.0.9 (X11/20071031) MIME-Version: 1.0 To: Pierre Gaston References: <479D3740.6080406@tlinx.org> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by goneo X-Spam-Score: -1.572 X-detected-kernel: by monty-python.gnu.org: FreeBSD 6.x (1) Cc: Linda Walsh , bug-bash@gnu.org Subject: Re: capturing sub-expressions? X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Jan 2008 21:20:29 -0000 Pierre Gaston schrieb: > On Jan 28, 2008 4:00 AM, Linda Walsh 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? > > I don't think so, you can only use =~ and BASE_REMATCH > >> If the full expression was in a shellvar "Options", I thought about >> using something like: >> ${Option//!(expr)} >> which I hoped would have "!(expr) match anything but my desired >> expression, and the double "/" would say allow it to match multiple >> times, but it appears the "!()" construct is limited to pathname >> expansion? Presuming that is true (limited to pathname expansion), >> is there anyway to do it on Shell vars? > > !( ) is indeed not very intuitive, it is not limited to pathname > expansion but it is not as interesting as it might seem. > > !(expr) will match anything that is not expr, for instance !(foo) will > match f and bar, but it also match "fooa", > the only thing that is not match is exactly "foo", which is useful if > you do: "echo !(foo)" to list all the files except > the one named "foo". > > Now if you use parameter expansion : > var=fooa;echo ${var//!(foo)/b} # prints "b" because !(foo) matches "fooa" > var=foo; echo ${var/!(foo)/b} # prints "bo" because !(foo) matches "fo" > var=foo; echo ${var/!(foo)/b} # prints "bb" because !(foo) matches "fo" and "o" My impression is that the pattern lookup depends on whether or not a '!' is involved. If the pattern does not contain a '!', the shell looks for matching substrings, from left to right. If it contains a '!', the value as a whole is matched. Example: x=12ab34; echo ${x//+([0-9])/X} # prints XabX x=12ab34; echo ${x//!(+([0-9]))/X} # prints X If the same algorithm had been applied in the 2nd case, the first substring matching the pattern "not a sequence of at least one digit" would have been 'a' (or maybe 'ab'), and the output would have been '12Xb34' (or '12X34'). IMHO (please correct me if I'm wrong) this contradicts the usual meaning of the '!' operator and makes it nearly useless - except in the simple "echo !(foo)" case you mentioned. Bernd -- Bernd Eggink monoped@sudrala.de http://sudrala.de From MAILER-DAEMON Tue Jan 29 16:25:04 2008 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1JJxx2-0006Vn-Hw for mharc-bug-bash@gnu.org; Tue, 29 Jan 2008 16:25:04 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JJxx0-0006Si-I3 for bug-bash@gnu.org; Tue, 29 Jan 2008 16:25:02 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JJxwv-0006Lz-Q7 for bug-bash@gnu.org; Tue, 29 Jan 2008 16:25:02 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JJxwv-0006Lj-Lm for bug-bash@gnu.org; Tue, 29 Jan 2008 16:24:57 -0500 Received: from ug-out-1314.google.com ([66.249.92.172]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JJxwv-0008Qw-NZ for bug-bash@gnu.org; Tue, 29 Jan 2008 16:24:57 -0500 Received: by ug-out-1314.google.com with SMTP id a2so395771ugf.48 for ; Tue, 29 Jan 2008 13:24:56 -0800 (PST) Received: by 10.67.20.19 with SMTP id x19mr1937168ugi.48.1201641895650; Tue, 29 Jan 2008 13:24:55 -0800 (PST) Received: by 10.67.123.1 with HTTP; Tue, 29 Jan 2008 13:24:55 -0800 (PST) Message-ID: <7c1bea4b0801291324l4883567ap394970444d8ddb3b@mail.gmail.com> Date: Wed, 30 Jan 2008 00:24:55 +0300 From: "Stepan Koltsov" Sender: stepancheg@mx1.ru To: "Stepan Koltsov" , "Pierre Gaston" , bug-bash@gnu.org, bash@packages.debian.org In-Reply-To: <20080129211641.GA11365@dementia.proulx.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <7c1bea4b0801290004r2b2e5290j7967e770971790bd@mail.gmail.com> <7c1bea4b0801291009u51f3d4cckad6ab9879304ecdc@mail.gmail.com> <7c1bea4b0801291141gf686665t5f1881056e094255@mail.gmail.com> <20080129211641.GA11365@dementia.proulx.com> X-Google-Sender-Auth: 41d35b4311d5ba95 X-detected-kernel: by monty-python.gnu.org: Linux 2.6 (newer, 2) Cc: Subject: Re: -e does not work with subscript X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Jan 2008 21:25:03 -0000 On 1/30/08, Bob Proulx wrote: > Stepan Koltsov wrote: > > set -e > > ( cd some-dir && ./build.sh ) > > ... > > Most readers (and writers) expect script to fail if "./build.sh" failed. So > > I think that outer bash should exit with error on "(false)" :-) > > Of course, script can be rewritten as > > ( cd some-dir && ./build.sh ) || false > > Of course the script can also be written as: > > make -C some-dir -C flag of make is the reason while such strange behavior of bash is not well known ;-) S. From MAILER-DAEMON Tue Jan 29 16:30:06 2008 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1JJy1u-0001J5-AC for mharc-bug-bash@gnu.org; Tue, 29 Jan 2008 16:30:06 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JJy1s-0001IQ-FU for bug-bash@gnu.org; Tue, 29 Jan 2008 16:30:04 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JJy1q-0001Hk-SX for bug-bash@gnu.org; Tue, 29 Jan 2008 16:30:03 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JJy1q-0001He-I3 for bug-bash@gnu.org; Tue, 29 Jan 2008 16:30:02 -0500 Received: from mpv2.tis.cwru.edu ([129.22.105.37]) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_3DES_EDE_CBC_SHA1:24) (Exim 4.60) (envelope-from ) id 1JJy1q-0001CG-GQ for bug-bash@gnu.org; Tue, 29 Jan 2008 16:30:02 -0500 Received: from mpv6.TIS.cwru.edu (mpv6.TIS.CWRU.Edu [129.22.104.221]) by mpv2.tis.cwru.edu (MOS 3.8.6-GA) with ESMTP id CQH20570 for ; Tue, 29 Jan 2008 16:29:59 -0500 (EST) Received: from multivac.cwru.edu (multivac.its.CWRU.Edu [129.22.114.26]) by mpv6.TIS.cwru.edu (MOS 3.8.6-GA) with SMTP id DWQ63618 for ; Tue, 29 Jan 2008 16:29:57 -0500 (EST) Received: (qmail 22010 invoked by uid 500); 29 Jan 2008 21:30:19 -0000 To: Bernd Eggink In-Reply-To: <479F9888.1040403@sudrala.de> (Bernd Eggink's message of "Tue\, 29 Jan 2008 22\:20\:08 +0100") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1 (gnu/linux) References: <479D3740.6080406@tlinx.org> <479F9888.1040403@sudrala.de> From: prj@po.cwru.edu (Paul Jarc) Organization: What did you have in mind? A short, blunt, human pyramid? Mail-Copies-To: nobody Mail-Followup-To: Bernd Eggink , Pierre Gaston , Linda Walsh , bug-bash@gnu.org Date: Tue, 29 Jan 2008 16:29:56 -0500 Message-ID: Lines: 33 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Junkmail-Status: score=10/49, host=mpv2.tis.cwru.edu X-Junkmail-SD-Raw: score=unknown, refid=str=0001.0A090204.479F9AD9.0033,ss=1,fgs=0, ip=129.22.104.221, so=2007-10-30 19:00:17, dmn=5.4.3/2007-11-16 X-Junkmail-IWF: false X-detected-kernel: by monty-python.gnu.org: Genre and OS details not recognized. Cc: Linda Walsh , Pierre Gaston , bug-bash@gnu.org Subject: Re: capturing sub-expressions? X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Jan 2008 21:30:04 -0000 Bernd Eggink wrote: > My impression is that the pattern lookup depends on whether or not a > !' is involved. If the pattern does not contain a '!', the shell looks > for matching substrings, from left to right. If it contains a '!', the > value as a whole is matched. It looks for substrings in both cases - specifically, the longest matching substring, which might happen to be the entire string. With !(), that is often the case. > x=12ab34; echo ${x//+([0-9])/X} # prints XabX > x=12ab34; echo ${x//!(+([0-9]))/X} # prints X > > If the same algorithm had been applied in the 2nd case, the first > substring matching the pattern "not a sequence of at least one digit" > would have been 'a' (or maybe 'ab'), and the output would have been > 12Xb34' (or '12X34'). "12ab34" is also "not a sequence of at least one digit", so as the longest match, it is preferred. Note how "not a sequence of at least one digit" differs from "a sequence of at least one nondigit"; the latter is specified as +([!0-9]) and has the behavior you expect !(+([0-9])) to have. > IMHO (please correct me if I'm wrong) this contradicts the usual > meaning of the '!' operator Negation is negation, but it has different effects on the overall result depending on where you place it in the pattern. paul From MAILER-DAEMON Tue Jan 29 17:58:56 2008 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1JJzPs-0000Q2-K1 for mharc-bug-bash@gnu.org; Tue, 29 Jan 2008 17:58:56 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JJzPq-0000Pv-Sl for bug-bash@gnu.org; Tue, 29 Jan 2008 17:58:54 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JJzPp-0000Pg-8N for bug-bash@gnu.org; Tue, 29 Jan 2008 17:58:53 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JJzPp-0000Pb-4O for bug-bash@gnu.org; Tue, 29 Jan 2008 17:58:53 -0500 Received: from m2.goneo.de ([82.100.220.83]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JJzPp-0004VP-36 for bug-bash@gnu.org; Tue, 29 Jan 2008 17:58:53 -0500 Received: from localhost (localhost.goneo.de [127.0.0.1]) by scan.goneo.de (Postfix) with ESMTP id 9465E130D65; Tue, 29 Jan 2008 23:58:51 +0100 (CET) Received: from m2.goneo.de ([127.0.0.1]) by localhost (m2.goneo.de [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 18116-01-2; Tue, 29 Jan 2008 23:58:34 +0100 (CET) Received: from [192.168.178.2] (d028186.adsl.hansenet.de [80.171.28.186]) by m2-smtp.goneo.de (Postfix) with ESMTP id F4101130CE2; Tue, 29 Jan 2008 23:57:04 +0100 (CET) Message-ID: <479FAF40.1080209@sudrala.de> Date: Tue, 29 Jan 2008 23:57:04 +0100 From: Bernd Eggink User-Agent: Thunderbird 2.0.0.9 (X11/20071031) MIME-Version: 1.0 To: Bernd Eggink , Pierre Gaston , Linda Walsh , bug-bash@gnu.org References: <479D3740.6080406@tlinx.org> <479F9888.1040403@sudrala.de> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by goneo X-Spam-Score: -1.645 X-detected-kernel: by monty-python.gnu.org: FreeBSD 6.x (1) Cc: Subject: Re: capturing sub-expressions? X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Jan 2008 22:58:55 -0000 Paul Jarc schrieb: > Bernd Eggink wrote: >> My impression is that the pattern lookup depends on whether or not a >> !' is involved. If the pattern does not contain a '!', the shell looks >> for matching substrings, from left to right. If it contains a '!', the >> value as a whole is matched. > > It looks for substrings in both cases - specifically, the longest > matching substring, which might happen to be the entire string. With > !(), that is often the case. > >> x=12ab34; echo ${x//+([0-9])/X} # prints XabX >> x=12ab34; echo ${x//!(+([0-9]))/X} # prints X >> >> If the same algorithm had been applied in the 2nd case, the first >> substring matching the pattern "not a sequence of at least one digit" >> would have been 'a' (or maybe 'ab'), and the output would have been >> 12Xb34' (or '12X34'). > > "12ab34" is also "not a sequence of at least one digit", so as the > longest match, it is preferred. Thanks, that made it clear. The crucial point, that the longest match is preferred in any case, had slipped out of my mind (though I have been using this for decades...). Regards, Bernd -- Bernd Eggink monoped@sudrala.de http://sudrala.de From MAILER-DAEMON Tue Jan 29 18:30:59 2008 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1JJzut-0004G0-64 for mharc-bug-bash@gnu.org; Tue, 29 Jan 2008 18:30:59 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JJzur-0004FO-L7 for bug-bash@gnu.org; Tue, 29 Jan 2008 18:30:57 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JJzup-0004Eg-Fj for bug-bash@gnu.org; Tue, 29 Jan 2008 18:30:56 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JJzup-0004Ec-8r for bug-bash@gnu.org; Tue, 29 Jan 2008 18:30:55 -0500 Received: from ishtar.tlinx.org ([64.81.245.74]) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1JJzup-0002tz-8L for bug-bash@gnu.org; Tue, 29 Jan 2008 18:30:55 -0500 Received: from [192.168.3.11] (Athena [192.168.3.11]) by ishtar.tlinx.org (8.13.3/8.12.10/SuSE Linux 0.7) with ESMTP id m0TNUmI7006869; Tue, 29 Jan 2008 15:30:48 -0800 Message-ID: <479FB728.6080406@tlinx.org> Date: Tue, 29 Jan 2008 15:30:48 -0800 From: Linda Walsh User-Agent: Thunderbird 2.0.0.9 (Windows/20071031) MIME-Version: 1.0 To: Pierre Gaston , bug-bash@gnu.org References: <479D3740.6080406@tlinx.org> <479F9888.1040403@sudrala.de> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-detected-kernel: by monty-python.gnu.org: Linux 2.6 (newer, 2) Cc: Subject: matching !(patterns) X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Jan 2008 23:30:58 -0000 Paul Jarc wrote: > It looks for substrings in both cases - specifically, the longest > matching substring, which might happen to be the entire string. With > !(), that is often the case. > >> x=12ab34; echo ${x//+([0-9])/X} # prints XabX >> x=12ab34; echo ${x//!(+([0-9]))/X} # prints X --- The longest matching substring (because you use "/" to start the pattern, yes?) I'm not sure I fully understand this behavior though. Let's have s="thomas rich george" Manpage says "!()" will match anything except one of the patterns. "$s" is 1 pattern, no? (no alternation); 1 pattern containing "thomas rich george", yes? Then if I use !($s) as the replacement pattern within in the substitute operator, ( ${s//!($s)/X} ) the !($s) should match any string except what is in "$s" ("thomas rich george"). So in the substitute, the string to replace (the "!($s) part) should match nothing in my variable "$s", so I'd think no replacement would be done. I.e. the output would be unchanged. But when I try it that's not what I get: > echo \"${s//!($s)/X}\" "XX" # why two X's? if I use 1 "/" instead of double: > echo \"${s/!($s)/X}\" "Xe" # why an "e" afterwards? ----- The converse works as expected: > echo \"${s//+($s)/X}\" "X" > echo \"${s/+($s)/X}\" "X" From MAILER-DAEMON Tue Jan 29 18:48:13 2008 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1JK0BY-0001ce-Q9 for mharc-bug-bash@gnu.org; Tue, 29 Jan 2008 18:48:12 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JK0BW-0001bn-EH for bug-bash@gnu.org; Tue, 29 Jan 2008 18:48:10 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JK0BU-0001bQ-3Z for bug-bash@gnu.org; Tue, 29 Jan 2008 18:48:09 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JK0BT-0001bM-TS for bug-bash@gnu.org; Tue, 29 Jan 2008 18:48:08 -0500 Received: from mpv2.tis.cwru.edu ([129.22.105.37]) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_3DES_EDE_CBC_SHA1:24) (Exim 4.60) (envelope-from ) id 1JK0BU-0005wd-3U for bug-bash@gnu.org; Tue, 29 Jan 2008 18:48:08 -0500 Received: from mpv5.TIS.cwru.edu (mpv5.tis.CWRU.Edu [129.22.105.51]) by mpv2.tis.cwru.edu (MOS 3.8.6-GA) with ESMTP id CQH32679 for ; Tue, 29 Jan 2008 18:48:05 -0500 (EST) Received: from multivac.cwru.edu (multivac.its.CWRU.Edu [129.22.114.26]) by mpv5.TIS.cwru.edu (MOS 3.8.6-GA) with SMTP id DWJ65547 for ; Tue, 29 Jan 2008 18:48:04 -0500 (EST) Received: (qmail 22820 invoked by uid 500); 29 Jan 2008 23:48:26 -0000 To: Linda Walsh In-Reply-To: <479FB728.6080406@tlinx.org> (Linda Walsh's message of "Tue\, 29 Jan 2008 15\:30\:48 -0800") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1 (gnu/linux) References: <479D3740.6080406@tlinx.org> <479F9888.1040403@sudrala.de> <479FB728.6080406@tlinx.org> From: prj@po.cwru.edu (Paul Jarc) Organization: What did you have in mind? A short, blunt, human pyramid? Mail-Copies-To: nobody Mail-Followup-To: Linda Walsh , Pierre Gaston , bug-bash@gnu.org Date: Tue, 29 Jan 2008 18:48:01 -0500 Message-ID: Lines: 47 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Junkmail-Status: score=10/49, host=mpv2.tis.cwru.edu X-Junkmail-SD-Raw: score=unknown, refid=str=0001.0A090202.479FBB36.0097,ss=1,fgs=0, ip=129.22.105.51, so=2007-10-30 19:00:17, dmn=5.4.3/2007-11-16 X-Junkmail-IWF: false X-detected-kernel: by monty-python.gnu.org: Genre and OS details not recognized. Cc: Pierre Gaston , bug-bash@gnu.org Subject: Re: matching !(patterns) X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Jan 2008 23:48:10 -0000 Linda Walsh wrote: > The longest matching substring (because you use "/" to start the pattern, > yes?) No, !() normally uses the longest match, just like *, *(), and +(). > s="thomas rich george" > > Manpage says "!()" will match anything except one of the patterns. > > "$s" is 1 pattern, no? (no alternation); 1 pattern containing > "thomas rich george", yes? Right. > Then if I use !($s) as the replacement pattern within in the substitute > operator, ( ${s//!($s)/X} ) the !($s) should match any string > except what is in "$s" ("thomas rich george"). It will match the longest substring of $s that is not $s itself - which is the first N-1 characters of s. With //, it will replace every match, so the final character will also be replaced, since it is not the same as all of $s. > So in the substitute, the string to replace (the "!($s) part) should > match nothing in my variable "$s", so I'd think no replacement would > be done. You're right that $s as a whole does not match !($s). But that isn't the only candidate for matching. Every substring is a candidate. The first position where a match is found is used, with the longest match starting at that position. To check whether a string as a whole matches a pattern, instead of checking for a matching substring, you can use case. (Or, if the pattern is a literal string with no special characters, you can use test.) >> echo \"${s//!($s)/X}\" > "XX" # why two X's? if I use 1 "/" instead of double: >> echo \"${s/!($s)/X}\" > "Xe" # why an "e" afterwards? With / instead of //, only the first match is replaced. paul From MAILER-DAEMON Tue Jan 29 18:52:08 2008 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1JK0FM-0002Na-0Z for mharc-bug-bash@gnu.org; Tue, 29 Jan 2008 18:52:08 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JK0FJ-0002NM-Vo for bug-bash@gnu.org; Tue, 29 Jan 2008 18:52:06 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JK0FI-0002NA-I2 for bug-bash@gnu.org; Tue, 29 Jan 2008 18:52:05 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JK0FI-0002N7-FN for bug-bash@gnu.org; Tue, 29 Jan 2008 18:52:04 -0500 Received: from ishtar.tlinx.org ([64.81.245.74]) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1JK0FI-0006XI-D8 for bug-bash@gnu.org; Tue, 29 Jan 2008 18:52:04 -0500 Received: from [192.168.3.11] (Athena [192.168.3.11]) by ishtar.tlinx.org (8.13.3/8.12.10/SuSE Linux 0.7) with ESMTP id m0TNq1AY007127; Tue, 29 Jan 2008 15:52:01 -0800 Message-ID: <479FBC21.7010602@tlinx.org> Date: Tue, 29 Jan 2008 15:52:01 -0800 From: Linda Walsh User-Agent: Thunderbird 2.0.0.9 (Windows/20071031) MIME-Version: 1.0 To: bug-bash@gnu.org References: <7c1bea4b0801290004r2b2e5290j7967e770971790bd@mail.gmail.com> <7c1bea4b0801291009u51f3d4cckad6ab9879304ecdc@mail.gmail.com> <7c1bea4b0801291141gf686665t5f1881056e094255@mail.gmail.com> In-Reply-To: <7c1bea4b0801291141gf686665t5f1881056e094255@mail.gmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-detected-kernel: by monty-python.gnu.org: Linux 2.6 (newer, 2) Cc: Stepan Koltsov Subject: Re: -e does not work with subscript X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Jan 2008 23:52:06 -0000 Stepan Koltsov wrote: > BTW, my use case for "(false)" is: > > === > set -e > ( cd some-dir && make ) > ( cd other-dir && ./build.sh ) > ( cd third-dir && ant ) > === > > Most readers (and writers) expect script to fail if "make" failed. So > I think that outer bash should exit with error on "(false)" :-) ---- I wouldn't, since you are placing the ops in a subshell -- only the subshell has the "error", but the top level shell wouldn't have an error just because a subshell exited. If you want the shell to exit, use braces: { cd some-dir &* make ; } # braces don't parse as end-of-line delimiters # like parens do, so the semicolon is needed after make From MAILER-DAEMON Tue Jan 29 20:41:41 2008 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1JK1xN-00087e-TU for mharc-bug-bash@gnu.org; Tue, 29 Jan 2008 20:41:41 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JK1xL-00086z-V4 for bug-bash@gnu.org; Tue, 29 Jan 2008 20:41:39 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JK1xK-00086n-Ea for bug-bash@gnu.org; Tue, 29 Jan 2008 20:41:38 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JK1xK-00086k-9h for bug-bash@gnu.org; Tue, 29 Jan 2008 20:41:38 -0500 Received: from ishtar.tlinx.org ([64.81.245.74]) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1JK1xJ-0007GS-UV for bug-bash@gnu.org; Tue, 29 Jan 2008 20:41:38 -0500 Received: from [192.168.3.11] (Athena [192.168.3.11]) by ishtar.tlinx.org (8.13.3/8.12.10/SuSE Linux 0.7) with ESMTP id m0U1fZl8008344; Tue, 29 Jan 2008 17:41:35 -0800 Message-ID: <479FD5CF.1040807@tlinx.org> Date: Tue, 29 Jan 2008 17:41:35 -0800 From: Linda Walsh User-Agent: Thunderbird 2.0.0.9 (Windows/20071031) MIME-Version: 1.0 To: bug-bash@gnu.org, monoped@sudrala.de References: <479D3740.6080406@tlinx.org> <479DFFD6.3020005@sudrala.de> <479F6E75.5090801@tlinx.org> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-detected-kernel: by monty-python.gnu.org: Linux 2.6 (newer, 2) Cc: Subject: Re: capturing sub-expressions? X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Jan 2008 01:41:40 -0000 Paul Jarc wrote: > Linda Walsh wrote: >> In my copy of the man pages, Pattern matching is indented an extra >> level making it look like it's under Pathname Expansion and only >> applies there.... > > Pattern matching applies primarily to pathname expansion; other uses > explicitly refer to its use there: > ${parameter/pattern/string} > The pattern is expanded to produce a pattern just as in > pathname expansion. Parameter is expanded and the > longest match of pattern against its value is replaced > with string. [...] > >> I wanted to leave "myswitch2" as the only thing left in $p; > > p=" $p " > p=${p/* myswitch2 */myswitch} > p=${p/ */} ----- I simplified my example a bit too much... p="-e -p 60 -x" --- That's why I wanted the capture -- to pick out the 60 -- where 60 represents a positive integer. The space between the -p and the number is optional. I can get at the 60 using multiple "nibbles" off the front and end of the string, but no [easy] way I can think of to get at it directly. I figured with "capture", I could substitute it in as the replacement string. with nibbling, it makes for convoluted code that doesn't feel "robust" (and I can easily come up with specific (though unlikely to be used in practice) examples to cause failure). Harder targets included more "switches" (-b, -v and -t which all take arguments which may or may not be separated from the switch by a space. Switches (and their values) are space separated. I'm not worrying about supporting embedded spaces in filenames. p="-e -p60 -b 1m -v string -tfile" Switch -b has some decimal value with an optional suffix in the set "kmgtpesb". But the above target isn't really needed AFAIK in the near future. From MAILER-DAEMON Tue Jan 29 21:05:19 2008 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1JK2KE-0006WC-Vw for mharc-bug-bash@gnu.org; Tue, 29 Jan 2008 21:05:19 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JK2KD-0006W2-Tw for bug-bash@gnu.org; Tue, 29 Jan 2008 21:05:17 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JK2KC-0006Vh-7e for bug-bash@gnu.org; Tue, 29 Jan 2008 21:05:17 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JK2KC-0006Ve-2x for bug-bash@gnu.org; Tue, 29 Jan 2008 21:05:16 -0500 Received: from mpv3.tis.cwru.edu ([129.22.105.35]) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_3DES_EDE_CBC_SHA1:24) (Exim 4.60) (envelope-from ) id 1JK2KB-0003QQ-MP for bug-bash@gnu.org; Tue, 29 Jan 2008 21:05:16 -0500 Received: from mpv6.TIS.cwru.edu (mpv6.TIS.CWRU.Edu [129.22.104.221]) by mpv3.TIS.cwru.edu (MOS 3.8.6-GA) with ESMTP id CBT42776 for ; Tue, 29 Jan 2008 21:05:14 -0500 (EST) Received: from multivac.cwru.edu (multivac.its.CWRU.Edu [129.22.114.26]) by mpv6.TIS.cwru.edu (MOS 3.8.6-GA) with SMTP id DWS55993 for ; Tue, 29 Jan 2008 21:05:13 -0500 (EST) Received: (qmail 27885 invoked by uid 500); 30 Jan 2008 02:05:36 -0000 To: Linda Walsh In-Reply-To: <479FD5CF.1040807@tlinx.org> (Linda Walsh's message of "Tue\, 29 Jan 2008 17\:41\:35 -0800") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1 (gnu/linux) References: <479D3740.6080406@tlinx.org> <479DFFD6.3020005@sudrala.de> <479F6E75.5090801@tlinx.org> <479FD5CF.1040807@tlinx.org> From: prj@po.cwru.edu (Paul Jarc) Organization: What did you have in mind? A short, blunt, human pyramid? Mail-Copies-To: nobody Mail-Followup-To: Linda Walsh , bug-bash@gnu.org, monoped@sudrala.de Date: Tue, 29 Jan 2008 21:05:09 -0500 Message-ID: Lines: 10 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Junkmail-Status: score=10/49, host=mpv3.cwru.edu X-Junkmail-SD-Raw: score=unknown, refid=str=0001.0A090208.479FDB59.01AC,ss=1,fgs=0, ip=129.22.104.221, so=2007-10-30 19:00:17, dmn=5.4.3/2007-11-16 X-Junkmail-IWF: false X-detected-kernel: by monty-python.gnu.org: Genre and OS details not recognized. Cc: bug-bash@gnu.org, monoped@sudrala.de Subject: Re: capturing sub-expressions? X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Jan 2008 02:05:18 -0000 Linda Walsh wrote: > p="-e -p 60 -x" > --- > That's why I wanted the capture -- to pick out the 60 -- where 60 represents > a positive integer. The space between the -p and the number is optional. It sounds like you're looking for getopt. paul From MAILER-DAEMON Tue Jan 29 21:27:13 2008 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1JK2fR-0005J5-HL for mharc-bug-bash@gnu.org; Tue, 29 Jan 2008 21:27:13 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JK2fP-0005Ib-KW for bug-bash@gnu.org; Tue, 29 Jan 2008 21:27:11 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JK2fL-0005Hy-4P for bug-bash@gnu.org; Tue, 29 Jan 2008 21:27:11 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JK2fK-0005Hv-Uo for bug-bash@gnu.org; Tue, 29 Jan 2008 21:27:06 -0500 Received: from ishtar.tlinx.org ([64.81.245.74]) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1JK2fK-000722-Ob for bug-bash@gnu.org; Tue, 29 Jan 2008 21:27:07 -0500 Received: from [192.168.3.11] (Athena [192.168.3.11]) by ishtar.tlinx.org (8.13.3/8.12.10/SuSE Linux 0.7) with ESMTP id m0U2R5U6008899; Tue, 29 Jan 2008 18:27:05 -0800 Message-ID: <479FE079.7030203@tlinx.org> Date: Tue, 29 Jan 2008 18:27:05 -0800 From: Linda Walsh User-Agent: Thunderbird 2.0.0.9 (Windows/20071031) MIME-Version: 1.0 To: bug-bash@gnu.org References: <479D3740.6080406@tlinx.org> <479DFFD6.3020005@sudrala.de> <479F6E75.5090801@tlinx.org> <479FD5CF.1040807@tlinx.org> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-detected-kernel: by monty-python.gnu.org: Linux 2.6 (newer, 2) Cc: Paul Jarc Subject: Re: capturing sub-expressions? X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Jan 2008 02:27:12 -0000 Paul Jarc wrote: > Linda Walsh wrote: >> p="-e -p 60 -x" >> --- >> That's why I wanted the capture -- to pick out the 60 -- where 60 represents >> a positive integer. The space between the -p and the number is optional. > > It sounds like you're looking for getopt. --- I knew about getopt -- was just wanting a string-manipulation mechanism to do it, but am maybe getting too used to string manipulations in perl? Would still love to use perl's full RE's in bash expressions, such is life... (am not sure I want it enough to try implementing/merging them...:-)) Linda From MAILER-DAEMON Wed Jan 30 09:40:49 2008 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1JKE7N-0002Qh-Er for mharc-bug-bash@gnu.org; Wed, 30 Jan 2008 09:40:49 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JKB0e-0007y9-7A for bug-bash@gnu.org; Wed, 30 Jan 2008 06:21:40 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JKB0b-0007wP-Bd for bug-bash@gnu.org; Wed, 30 Jan 2008 06:21:39 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JKB0b-0007wK-5e for bug-bash@gnu.org; Wed, 30 Jan 2008 06:21:37 -0500 Received: from moderators.individual.net ([130.133.4.7]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JKB0a-0005kk-Rl for bug-bash@gnu.org; Wed, 30 Jan 2008 06:21:37 -0500 Received: from outpost1.zedat.fu-berlin.de ([130.133.4.66]) by moderators.individual.net (Exim 4.69) for gnu-bash-bug@moderators.individual.net with esmtp (envelope-from ) id <1JKB0Z-0004sA-DT>; Wed, 30 Jan 2008 12:21:35 +0100 Received: from relay1.zedat.fu-berlin.de ([130.133.4.67]) by outpost1.zedat.fu-berlin.de (Exim 4.69) for gnu-bash-bug@moderators.individual.net with esmtp (envelope-from ) id <1JKB0Z-0007Xz-Ca>; Wed, 30 Jan 2008 12:21:35 +0100 Received: from curry.zedat.fu-berlin.de ([130.133.1.2]) by relay1.zedat.fu-berlin.de (Exim 4.69) for gnu-bash-bug@moderators.individual.net with esmtp (envelope-from ) id <1JKB0Z-0004lV-Ba>; Wed, 30 Jan 2008 12:21:35 +0100 Received: by Curry.ZEDAT.FU-Berlin.DE (Smail3.2.0.98) from news.uni-berlin.de with bsmtp id ; Wed, 30 Jan 2008 12:21:35 +0100 (MET) To: gnu-bash-bug@moderators.individual.net Path: individual.net!not-for-mail From: Stefan Palme Newsgroups: gnu.bash.bug Date: 30 Jan 2008 11:21:34 GMT Lines: 25 Message-ID: <60b4tuF1pga90U3@mid.individual.net> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Orig-X-Trace: individual.net IfRKmB7auBnIZVeMmoDK6gNw2UCLQPkXymEWs0o+QFPUVmRZ4W Cancel-Lock: sha1:g2llfWJ8C4LoQf0xYhztKpIwxoA= User-Agent: Pan/0.132 (Waxed in Black) X-Originating-IP: 130.133.1.2 X-detected-kernel: by monty-python.gnu.org: Linux 2.6 (newer, 3) X-Mailman-Approved-At: Wed, 30 Jan 2008 09:40:47 -0500 Cc: Subject: read output of process into a variable X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Jan 2008 11:21:40 -0000 Hi, don't know if this is the right newsgroup, but it's the only one I can find with "bash" in its name :-) I want to do something like this: result="" /usr/bin/output_generator | while read line; do extracteddata=`echo "$line" | sed -e 's/X/Y/'` result="$result $extracteddata" done /usr/bin/another_tool "$result" In the last line is "result" as empty as at the start of the whole thing - I guess because the inner "while" loop is executed in a subshell, so that changing the value of "result" in this loop does not affect the "outer result". How can I solve this? I have some very ugly solutions, but I guess there must be something "nice" :-) (using bash-3.2.17(1)-release) Thanks and regards -stefan- From MAILER-DAEMON Wed Jan 30 09:54:47 2008 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1JKEKt-0002s3-Do for mharc-bug-bash@gnu.org; Wed, 30 Jan 2008 09:54:47 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JKEKr-0002po-Ro for bug-bash@gnu.org; Wed, 30 Jan 2008 09:54:45 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JKEKp-0002nL-Qp for bug-bash@gnu.org; Wed, 30 Jan 2008 09:54:45 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JKEKp-0002n4-LM for bug-bash@gnu.org; Wed, 30 Jan 2008 09:54:43 -0500 Received: from moderators.individual.net ([130.133.4.7]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JKEKo-0001Rz-TL for bug-bash@gnu.org; Wed, 30 Jan 2008 09:54:43 -0500 Received: from wa-out-1112.google.com ([209.85.146.179]) by moderators.individual.net (Exim 4.69) for gnu-bash-bug@moderators.individual.net with esmtp (envelope-from ) id <1JKEKk-00033z-BU>; Wed, 30 Jan 2008 15:54:38 +0100 Received: by wa-out-1112.google.com with SMTP id j4so421860wah.1 for ; Wed, 30 Jan 2008 06:54:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; bh=kHolKNZUxVxYm4VfrICAV6oCoEALd7OwC11xuEWtqkk=; b=ubiSj0PTobEu8raO4/8r4l+RytuW3OsaezJPZIh72B/XO6BfLTXWwlYk8peWEb+q7jpdFQLvH1HViIUzLBXHPwLAPlDzHHTxpFQEYhG5v6z//1kBY4MFWKVzf5H+xl/ZgXQu5a8fVsyBMEax9Y1Dij+pslMsZDsYP9hwc+GsYnM= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=A2tsAZ0OqMTajvooQGbCYME2KlEfBnTv7oj07s6XUOu9EdntvdeU9HnPSlWJky/0bHWYqnM0ThQeOC3kZT/GqpuxerEaXiqLFO4hutZivq39nZwVgGZrPdm1zuqKQIAGihOPWZ6lx3PZIIcBK5cEhtR4mrCy6xtQdXn7Mb4Dmk4= Received: by 10.115.74.1 with SMTP id b1mr948441wal.93.1201704875583; Wed, 30 Jan 2008 06:54:35 -0800 (PST) Received: by 10.114.37.17 with HTTP; Wed, 30 Jan 2008 06:54:35 -0800 (PST) Message-ID: <2379dacc0801300654j39fd9f71t20817ffbbfc321ea@mail.gmail.com> Date: Wed, 30 Jan 2008 08:54:35 -0600 From: "Michael Potter" To: "Stefan Palme" In-Reply-To: <60b4tuF1pga90U3@mid.individual.net> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <60b4tuF1pga90U3@mid.individual.net> X-detected-kernel: by monty-python.gnu.org: Linux 2.6 (newer, 3) Cc: gnu-bash-bug@moderators.individual.net Subject: Re: read output of process into a variable X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Jan 2008 14:54:46 -0000 It is not a bug in bash. it is just how it works. the while loop creates a subshell and changes to the variables are not visable outside of the subshell. if you put the while loop first, then it will not create the subshell. do this: result="" while read line; do extracteddata=`echo "$line" | sed -e 's/X/Y/'` result="$result $extracteddata" done < <(/usr/bin/output_generator) /usr/bin/another_tool "$result" the <() is syntax for a named pipes. it makes a command look like a file. Be aware that this may leave files in your /tmp directory. BTW: I would use $() syntax instead of the backtic syntax; just easier to see. -- potter On 30 Jan 2008 11:21:34 GMT, Stefan Palme wrote: > Hi, > don't know if this is the right newsgroup, but it's the only one > I can find with "bash" in its name :-) > > I want to do something like this: > > result="" > /usr/bin/output_generator | while read line; do > extracteddata=`echo "$line" | sed -e 's/X/Y/'` > result="$result $extracteddata" > done > /usr/bin/another_tool "$result" > > In the last line is "result" as empty as at the start of the > whole thing - I guess because the inner "while" loop is executed > in a subshell, so that changing the value of "result" in this > loop does not affect the "outer result". > > How can I solve this? I have some very ugly solutions, but > I guess there must be something "nice" :-) > > (using bash-3.2.17(1)-release) > > Thanks and regards > -stefan- > > > From MAILER-DAEMON Wed Jan 30 10:51:30 2008 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1JKFDl-00024N-TB for mharc-bug-bash@gnu.org; Wed, 30 Jan 2008 10:51:29 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JKFDj-00022j-DN for bug-bash@gnu.org; Wed, 30 Jan 2008 10:51:27 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JKFDh-00021E-RL for bug-bash@gnu.org; Wed, 30 Jan 2008 10:51:26 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JKFDh-000215-Fu for bug-bash@gnu.org; Wed, 30 Jan 2008 10:51:25 -0500 Received: from moderators.individual.net ([130.133.4.7]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JKFDh-00067q-5R for bug-bash@gnu.org; Wed, 30 Jan 2008 10:51:25 -0500 Received: from outpost1.zedat.fu-berlin.de ([130.133.4.66]) by moderators.individual.net (Exim 4.69) for gnu-bash-bug@moderators.individual.net with esmtp (envelope-from ) id <1JKFDg-0004oN-DZ>; Wed, 30 Jan 2008 16:51:24 +0100 Received: from relay1.zedat.fu-berlin.de ([130.133.4.67]) by outpost1.zedat.fu-berlin.de (Exim 4.69) for gnu-bash-bug@moderators.individual.net with esmtp (envelope-from ) id <1JKFDg-0001fr-Cg>; Wed, 30 Jan 2008 16:51:24 +0100 Received: from curry.zedat.fu-berlin.de ([130.133.1.2]) by relay1.zedat.fu-berlin.de (Exim 4.69) for gnu-bash-bug@moderators.individual.net with esmtp (envelope-from ) id <1JKFDg-0002YO-Bk>; Wed, 30 Jan 2008 16:51:24 +0100 Received: by Curry.ZEDAT.FU-Berlin.DE (Smail3.2.0.98) from news.uni-berlin.de with bsmtp id ; Wed, 30 Jan 2008 16:51:24 +0100 (MET) To: gnu-bash-bug@moderators.individual.net Path: individual.net!not-for-mail From: Stefan Palme Newsgroups: gnu.bash.bug Date: 30 Jan 2008 15:51:23 GMT Lines: 30 Message-ID: <60bknrF1pga90U5@mid.individual.net> References: <60b4tuF1pga90U3@mid.individual.net> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Orig-X-Trace: individual.net QJmX6eeywX7wr7FuwQD/FgR+AaN3BFKUD5yVSv8EGo+0l4582b Cancel-Lock: sha1:8IQOVZuozQL8VD131ZhazXv+ayU= User-Agent: Pan/0.132 (Waxed in Black) X-Originating-IP: 130.133.1.2 X-detected-kernel: by monty-python.gnu.org: Linux 2.6 (newer, 3) Cc: Subject: Re: read output of process into a variable X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Jan 2008 15:51:27 -0000 Thanks for your reply. > It is not a bug in bash. it is just how it works. I know, but did not find a gnu.bash.help newsgroup :$ > do this: > > result="" > while read line; do > extracteddata=`echo "$line" | sed -e 's/X/Y/'` result="$result > $extracteddata" > done < <(/usr/bin/output_generator) > /usr/bin/another_tool "$result" Nice... ;-) In real life even "/usr/bin/output_generator" is not only a call to one program, but a piped command consisting of three or four steps, which makes the whole thing unreadable again. But I guess I can create and use a function containing the "output_generator" chain... > BTW: I would use $() syntax instead of the backtic syntax; just easier > to see. Ok... Thanks and regards -stefan- From MAILER-DAEMON Wed Jan 30 15:41:42 2008 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1JKJkc-0004Mq-F9 for mharc-bug-bash@gnu.org; Wed, 30 Jan 2008 15:41:42 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JKJkZ-0004K4-OX for bug-bash@gnu.org; Wed, 30 Jan 2008 15:41:39 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JKJkY-0004I3-6P for bug-bash@gnu.org; Wed, 30 Jan 2008 15:41:39 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JKJkY-0004Ht-1q for bug-bash@gnu.org; Wed, 30 Jan 2008 15:41:38 -0500 Received: from colin.muc.de ([193.149.48.1] helo=mail.muc.de) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1JKJkX-0005qI-Gr for bug-bash@gnu.org; Wed, 30 Jan 2008 15:41:37 -0500 Received: (qmail 37881 invoked by uid 3782); 30 Jan 2008 20:41:31 -0000 Received: from acm.muc.de (p57AF6177.dip.t-dialin.net [87.175.97.119]) by colin2.muc.de (tmda-ofmipd) with ESMTP; Wed, 30 Jan 2008 21:41:30 +0100 Received: (qmail 3319 invoked by uid 1000); 30 Jan 2008 20:52:32 -0000 Date: Wed, 30 Jan 2008 20:52:32 +0000 To: bug-bash@gnu.org Message-ID: <20080130205232.GA2535@muc.de> References: <20080128205858.GB2513@muc.de> <479E52BC.5080204@byu.net> <20080128235722.GA12751@dementia.proulx.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20080128235722.GA12751@dementia.proulx.com> User-Agent: Mutt/1.5.9i X-Delivery-Agent: TMDA/1.1.5 (Fettercairn) From: Alan Mackenzie X-Primary-Address: acm@muc.de X-detected-kernel: by monty-python.gnu.org: FreeBSD 4.6-4.9 Subject: Re: bash 2.05b.0(1)-release on Debian Sarge: [A-Z]* expands as [A-Za-z]* :-( X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Jan 2008 20:41:40 -0000 Hi, Bob and Eric, Thanks muchly for the help! On Mon, Jan 28, 2008 at 04:57:22PM -0700, Bob Proulx wrote: > Eric Blake wrote: > > According Alan Mackenzie: > > | % ls [A-Z]* > > | . Sadly, ls ignores my intentions and undiscerningly prints a list of > > | all files whose names begin with a letter, big or small. > > Actually, it follows your (unintended) directions, thanks to your > > current locale, which does a collation sort. You aren't doing > > [A-Za-z], but [AaBb...Z], because your current locale prefers > > case-insensitive collation. Change your locale (try LC_COLLATE=C or > > LC_ALL=C) to see the difference. Yes, this works! Ah. I've got $LANG set to en_GB. Who did this? How dare they! OK, I did this myself, somehow, presumably during installation of Debian Sarge. Why didn't "they" tell me I was messing up my shell? Why do I feel so stupid? (OK, don't answer that one!) More to the point, where are these variables (LANG, LC_{ALL,COLLATE,CTYPE,MESSAGES,NUMERIC} documented? They're mentioned skimpily in the bash man page, but where are they fully documented? What is a "locale category"? What set of values can these variables take? _How_ are they "used"? > Or in the new expression syntax say that you are looking for upper > case letters explicitly. > > ls -d [[:upper:]]* > That should work regardless of locale setting. OK. I'll use that if I really have to, but I'd prefer [A-Z] to work right. Again, thanks! > Bob From MAILER-DAEMON Wed Jan 30 15:44:57 2008 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1JKJnl-0005kq-K5 for mharc-bug-bash@gnu.org; Wed, 30 Jan 2008 15:44:57 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JKJnk-0005kC-57 for bug-bash@gnu.org; Wed, 30 Jan 2008 15:44:56 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JKJnf-0005gx-CD for bug-bash@gnu.org; Wed, 30 Jan 2008 15:44:55 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JKJne-0005gd-IY for bug-bash@gnu.org; Wed, 30 Jan 2008 15:44:50 -0500 Received: from joseki.proulx.com ([216.17.153.58]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JKJne-0006ZI-0y for bug-bash@gnu.org; Wed, 30 Jan 2008 15:44:50 -0500 Received: from dementia.proulx.com (dementia.proulx.com [192.168.1.115]) by joseki.proulx.com (Postfix) with ESMTP id D1B51FA5B; Wed, 30 Jan 2008 13:44:47 -0700 (MST) Received: by dementia.proulx.com (Postfix, from userid 1000) id C2D9C3CC669; Wed, 30 Jan 2008 13:44:47 -0700 (MST) Date: Wed, 30 Jan 2008 13:44:47 -0700 To: Stefan Palme Message-ID: <20080130204447.GA22600@dementia.proulx.com> Mail-Followup-To: Stefan Palme , bug-bash@gnu.org References: <60b4tuF1pga90U3@mid.individual.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <60b4tuF1pga90U3@mid.individual.net> User-Agent: Mutt/1.5.13 (2006-08-11) From: bob@proulx.com (Bob Proulx) X-detected-kernel: by monty-python.gnu.org: Genre and OS details not recognized. Cc: bug-bash@gnu.org Subject: Re: read output of process into a variable X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Jan 2008 20:44:56 -0000 Stefan Palme wrote: > don't know if this is the right newsgroup, but it's the only one > I can find with "bash" in its name :-) That newsgroup is gatewayed to the bug-bash mailing list. > I want to do something like this: > > result="" > /usr/bin/output_generator | while read line; do > extracteddata=`echo "$line" | sed -e 's/X/Y/'` > result="$result $extracteddata" > done > /usr/bin/another_tool "$result" > > In the last line is "result" as empty as at the start of the > whole thing - I guess because the inner "while" loop is executed > in a subshell, so that changing the value of "result" in this > loop does not affect the "outer result". Please See the Bash FAQ question E4 for more information describing this problem. Bob From MAILER-DAEMON Wed Jan 30 15:50:36 2008 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1JKJtE-0000HP-L9 for mharc-bug-bash@gnu.org; Wed, 30 Jan 2008 15:50:36 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JKJtC-0000GM-3L for bug-bash@gnu.org; Wed, 30 Jan 2008 15:50:34 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JKJtA-0000Ez-3r for bug-bash@gnu.org; Wed, 30 Jan 2008 15:50:32 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JKJt8-0000Et-Vo for bug-bash@gnu.org; Wed, 30 Jan 2008 15:50:31 -0500 Received: from joseki.proulx.com ([216.17.153.58]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JKJt8-00087r-A5 for bug-bash@gnu.org; Wed, 30 Jan 2008 15:50:30 -0500 Received: from dementia.proulx.com (dementia.proulx.com [192.168.1.115]) by joseki.proulx.com (Postfix) with ESMTP id B84D5FA99; Wed, 30 Jan 2008 13:50:28 -0700 (MST) Received: by dementia.proulx.com (Postfix, from userid 1000) id A9E683CC669; Wed, 30 Jan 2008 13:50:28 -0700 (MST) Date: Wed, 30 Jan 2008 13:50:28 -0700 To: Alan Mackenzie Message-ID: <20080130205028.GA23405@dementia.proulx.com> Mail-Followup-To: Alan Mackenzie , bug-bash@gnu.org References: <20080128205858.GB2513@muc.de> <479E52BC.5080204@byu.net> <20080128235722.GA12751@dementia.proulx.com> <20080130205232.GA2535@muc.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20080130205232.GA2535@muc.de> User-Agent: Mutt/1.5.13 (2006-08-11) From: bob@proulx.com (Bob Proulx) X-detected-kernel: by monty-python.gnu.org: Genre and OS details not recognized. Cc: bug-bash@gnu.org Subject: Re: bash 2.05b.0(1)-release on Debian Sarge: [A-Z]* expands as [A-Za-z]* :-( X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Jan 2008 20:50:35 -0000 Alan Mackenzie wrote: > Ah. I've got $LANG set to en_GB. Who did this? How dare they! > OK, I did this myself, somehow, presumably during installation of > Debian Sarge. On Debian: sudo dpkg-reconfigure locales > Why didn't "they" tell me I was messing up my shell? Why do I feel > so stupid? (OK, don't answer that one!) :-) You might also want to look at this (now old and in need of updating but applies here perfectly) FAQ for coreutils. http://www.gnu.org/software/coreutils/faq/#Sort-does-not-sort-in-normal-order_0021 > More to the point, where are these variables (LANG, > LC_{ALL,COLLATE,CTYPE,MESSAGES,NUMERIC} documented? They're > mentioned skimpily in the bash man page, but where are they fully > documented? What is a "locale category"? What set of values can > these variables take? _How_ are they "used"? For documentation I would start here at the standards docs: http://www.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap08.html#tag_08_02 Bob From MAILER-DAEMON Thu Jan 31 02:10:51 2008 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1JKTZT-0007WO-BC for mharc-bug-bash@gnu.org; Thu, 31 Jan 2008 02:10:51 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JKTZQ-0007Vi-Tf for bug-bash@gnu.org; Thu, 31 Jan 2008 02:10:48 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JKTZQ-0007VW-8r for bug-bash@gnu.org; Thu, 31 Jan 2008 02:10:48 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JKTZQ-0007VT-5H for bug-bash@gnu.org; Thu, 31 Jan 2008 02:10:48 -0500 Received: from moderators.individual.net ([130.133.4.7]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JKTZP-0002fO-SU for bug-bash@gnu.org; Thu, 31 Jan 2008 02:10:48 -0500 Received: from outpost1.zedat.fu-berlin.de ([130.133.4.66]) by moderators.individual.net (Exim 4.69) for gnu-bash-bug@moderators.individual.net with esmtp (envelope-from ) id <1JKTZP-0006Ii-6y>; Thu, 31 Jan 2008 08:10:47 +0100 Received: from relay1.zedat.fu-berlin.de ([130.133.4.67]) by outpost1.zedat.fu-berlin.de (Exim 4.69) for gnu-bash-bug@moderators.individual.net with esmtp (envelope-from ) id <1JKTZP-0002PF-67>; Thu, 31 Jan 2008 08:10:47 +0100 Received: from curry.zedat.fu-berlin.de ([130.133.1.2]) by relay1.zedat.fu-berlin.de (Exim 4.69) for gnu-bash-bug@moderators.individual.net with esmtp (envelope-from ) id <1JKTZP-0006fh-5E>; Thu, 31 Jan 2008 08:10:47 +0100 Received: by Curry.ZEDAT.FU-Berlin.DE (Smail3.2.0.98) from news.uni-berlin.de with bsmtp id ; Thu, 31 Jan 2008 08:10:47 +0100 (MET) To: gnu-bash-bug@moderators.individual.net Path: individual.net!not-for-mail From: Stefan Palme Newsgroups: gnu.bash.bug Date: 31 Jan 2008 07:10:46 GMT Lines: 29 Message-ID: <60dajmF1pga90U6@mid.individual.net> References: <60b4tuF1pga90U3@mid.individual.net> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Orig-X-Trace: individual.net 5ykArmNC8YuXBgSL+cyetQvFcd4v2zHqGgPMaS3NYx8RxrFnoB Cancel-Lock: sha1:aAP2e4boZ8FZW26GLkB0WBHUI6Y= User-Agent: Pan/0.132 (Waxed in Black) X-Originating-IP: 130.133.1.2 X-detected-kernel: by monty-python.gnu.org: Linux 2.6 (newer, 3) Cc: Subject: Re: read output of process into a variable X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 Jan 2008 07:10:49 -0000 On Wed, 30 Jan 2008 13:44:47 -0700, Bob Proulx wrote: > Stefan Palme wrote: >> don't know if this is the right newsgroup, but it's the only one I can >> find with "bash" in its name :-) > > That newsgroup is gatewayed to the bug-bash mailing list. > >> I want to do something like this: >> >> result="" >> /usr/bin/output_generator | while read line; do >> extracteddata=`echo "$line" | sed -e 's/X/Y/'` result="$result >> $extracteddata" >> done >> /usr/bin/another_tool "$result" >> >> In the last line is "result" as empty as at the start of the whole >> thing - I guess because the inner "while" loop is executed in a >> subshell, so that changing the value of "result" in this loop does not >> affect the "outer result". > > Please See the Bash FAQ question E4 for more information describing this > problem. Thanks, I've understood the problem and solved it. And sorry for asking this FAQ on the wrong NG. Regards -stefan- From MAILER-DAEMON Thu Jan 31 09:33:42 2008 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1JKaU2-0007ZN-Gv for mharc-bug-bash@gnu.org; Thu, 31 Jan 2008 09:33:42 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JKSxf-0007rw-1y for bug-bash@gnu.org; Thu, 31 Jan 2008 01:31:47 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JKSxc-0007rg-NM for Bug-bash@gnu.org; Thu, 31 Jan 2008 01:31:45 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JKSxc-0007rc-IX for Bug-bash@gnu.org; Thu, 31 Jan 2008 01:31:44 -0500 Received: from kuber.nabble.com ([216.139.236.158]) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1JKSxc-00032r-6t for Bug-bash@gnu.org; Thu, 31 Jan 2008 01:31:44 -0500 Received: from isper.nabble.com ([192.168.236.156]) by kuber.nabble.com with esmtp (Exim 4.63) (envelope-from ) id 1JKSxZ-0003gY-1V for Bug-bash@gnu.org; Wed, 30 Jan 2008 22:31:41 -0800 Message-ID: <15198967.post@talk.nabble.com> Date: Wed, 30 Jan 2008 22:31:41 -0800 (PST) From: UniXman1234 To: Bug-bash@gnu.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Nabble-From: gangstarr88@msn.com X-detected-kernel: by monty-python.gnu.org: Linux 2.6 (newer, 3) X-Mailman-Approved-At: Thu, 31 Jan 2008 09:33:40 -0500 Cc: Subject: grep help, how do i make this shorter? X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 Jan 2008 06:31:47 -0000 Hi everyone, im trying to make the following command line shorter by introducing a script that join up all the grep commands ./new1a < numbers.txt | grep -i -v '^a ' | grep -i -v '^the ' | grep -i -v '^or ' | sort -f How would I go about merging all the greps into a scripe and putting all the words that should be excluded into a data file so would it be something like this ---exclude--- #!/bin/sh # exclude.sh grep -i -v ^datafile.txt ----end-------------- ---datafile.txt--- a the or ---end.txt--- so i would be able to execute it like ./new < numbers.txt | exclude | sort -f Thank you, i tried doing every possible way i could think of but it doesnt seem to work. Im a newb just started script programming 2 weeks ago -- View this message in context: http://www.nabble.com/grep-help%2C-how-do-i-make-this-shorter--tp15198967p15198967.html Sent from the Gnu - Bash mailing list archive at Nabble.com. From MAILER-DAEMON Thu Jan 31 12:43:37 2008 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1JKdRo-00062m-UG for mharc-bug-bash@gnu.org; Thu, 31 Jan 2008 12:43:37 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JKdRn-00060C-3g for bug-bash@gnu.org; Thu, 31 Jan 2008 12:43:35 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JKdRl-0005xK-9J for bug-bash@gnu.org; Thu, 31 Jan 2008 12:43:34 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JKdRl-0005xF-3R for bug-bash@gnu.org; Thu, 31 Jan 2008 12:43:33 -0500 Received: from wa-out-1112.google.com ([209.85.146.176]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JKdRk-0008QG-Hx for bug-bash@gnu.org; Thu, 31 Jan 2008 12:43:32 -0500 Received: by wa-out-1112.google.com with SMTP id k34so51763wah.10 for ; Thu, 31 Jan 2008 09:43:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to:subject:mime-version:content-type; bh=0AzZCldgjzgUHH9g3RlQvbw1FdDG+tKoCOsKcNsjPXE=; b=w7ijki+iAAVszB1HP+mCxwWYLXiZykp8eu1NfUxmoE0BUnXVwE2YbyOot5wAwhfQga/oue9U4NWu6z1reGOVm/SF+rxX5Ie4QewWBXP0uLRoW+AuvvJMod+pFuxD1Q6WtYWhxm9RbRNZABj7SLcMfpQWSQpBm8+6HWiCtykLIbw= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:mime-version:content-type; b=V4Xj3c9vyZO/tijBCjDcZRXc2ywNxDOjSqBCNgRBAcsFzjicQ/DSZvyzTmDfrBq/QazqhGGIGK3kNtyv8eWXsIF9pYZ77W8tWU197q4RMgM4h6SgSTJRV5uMHejsIDt22v5YgausJs+PjgYmLUEtef7OJQAHdfxCdsdt+qW3eTk= Received: by 10.114.157.1 with SMTP id f1mr2742436wae.13.1201801410226; Thu, 31 Jan 2008 09:43:30 -0800 (PST) Received: by 10.114.37.17 with HTTP; Thu, 31 Jan 2008 09:43:30 -0800 (PST) Message-ID: <2379dacc0801310943r3e215f36k9763f29d2191adf8@mail.gmail.com> Date: Thu, 31 Jan 2008 11:43:30 -0600 From: "Michael Potter" To: bug-bash@gnu.org MIME-Version: 1.0 X-detected-kernel: by monty-python.gnu.org: Linux 2.6 (newer, 2) Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Subject: errexit does not exit script in subshells X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 Jan 2008 17:43:35 -0000 Bash Bunch, Not surprisingly, bash does not exit the script when an error is detected in a subshell. I am hopeful that someone has a solution to this (other than: be careful to not use subshells). Here is the test run: ------------------- ./subshellnofail.sh BEGIN ERROR: ./subshellnofail.sh 10 <- would like the script to stop here. ONE ERROR: ./subshellnofail.sh 10 ------------------- Here is the sample script: ------------------ #!/bin/bash set -o errexit set -o noclobber set -o nounset set -o pipefail # if you fail on this line, get a newer version of bash. function traperr { echo "ERROR: ${BASH_SOURCE[0]} ${LINENO}" # exit 1 # does not seem to affect the program. # return 1 # does not seem to affect the program. } set -o errtrace trap traperr ERR echo "BEGIN" cat /etc/passwd |while read aLine do # in a subshell test=$(true | false | true |false); done echo "ONE" while read aLine do # not in a subshell test=$(true | false | true |false); done ) id 1JKiH0-0004ty-ST for Bug-bash@gnu.org; Thu, 31 Jan 2008 17:52:47 -0500 Received: from dementia.proulx.com (dementia.proulx.com [192.168.1.115]) by joseki.proulx.com (Postfix) with ESMTP id 618A5FA8D; Thu, 31 Jan 2008 15:52:46 -0700 (MST) Received: by dementia.proulx.com (Postfix, from userid 1000) id 590323CC3E0; Thu, 31 Jan 2008 15:52:46 -0700 (MST) Date: Thu, 31 Jan 2008 15:52:46 -0700 To: UniXman1234 Message-ID: <20080131225246.GB28986@dementia.proulx.com> Mail-Followup-To: UniXman1234 , Bug-bash@gnu.org References: <15198967.post@talk.nabble.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <15198967.post@talk.nabble.com> User-Agent: Mutt/1.5.13 (2006-08-11) From: bob@proulx.com (Bob Proulx) X-detected-kernel: by monty-python.gnu.org: Genre and OS details not recognized. Cc: Bug-bash@gnu.org Subject: Re: grep help, how do i make this shorter? X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 Jan 2008 22:52:49 -0000 UniXman1234 wrote: > ./new1a < numbers.txt | grep -i -v '^a ' | grep -i -v '^the ' | grep -i -v > '^or ' | sort -f > > How would I go about merging all the greps into a scripe and putting all the > words that should be excluded into a data file Many different ways. Look at the 'grep -f' option. Look at using sed. > so i would be able to execute it like > > ./new < numbers.txt | exclude | sort -f Here is one possibility. ./new < numbers.txt | grep -v -f exclude.txt | sort -f HTH, Bob From MAILER-DAEMON Thu Jan 31 18:58:48 2008 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1JKjIu-0004Ve-Hj for mharc-bug-bash@gnu.org; Thu, 31 Jan 2008 18:58:48 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JKjIs-0004Uo-OC for bug-bash@gnu.org; Thu, 31 Jan 2008 18:58:46 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JKjIr-0004UD-Mb for bug-bash@gnu.org; Thu, 31 Jan 2008 18:58:46 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JKjIr-0004U7-AA for bug-bash@gnu.org; Thu, 31 Jan 2008 18:58:45 -0500 Received: from wx-out-0506.google.com ([66.249.82.232]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JKjIq-0008PK-Sx for bug-bash@gnu.org; Thu, 31 Jan 2008 18:58:45 -0500 Received: by wx-out-0506.google.com with SMTP id s7so914418wxc.24 for ; Thu, 31 Jan 2008 15:58:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to:subject:mime-version:content-type; bh=HrxE8+cyJNLg1S4R18/2BBrexXQYytj6p7Om2KbZZE0=; b=ozIZ9ScSzwxNNnfzYgvqMdotIL879y1JKyHKzq1W+XslCtcguNbJTTL4g+LRqnsUR/HG/0P0DQzpI+ievhDSL+aZ4Da3eUvbXk2OvY0LdLWbWzaEVF4XQdkx/2xfPAreieGUzq3PoBajqHMNPDcoLttlE9ms0MtDBKlAB5ktHxg= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:mime-version:content-type; b=hi7pxPszcg1gFCU6cXZXbKNxbM4CzbSFX7FOMvfI3R6dLcOd+Ve/bE+Xl6zxekhvPYBdpA538/AbV8XBXz2hkgoFXZ0DSR2kJsJD5pf8SfJ42fxgNtfKZsL2NxKgAFKur5i/VDtMoDY+188IfRG2k9Ong57msPSmvSSjaVj8wZo= Received: by 10.114.175.16 with SMTP id x16mr3227888wae.12.1201823922995; Thu, 31 Jan 2008 15:58:42 -0800 (PST) Received: by 10.114.37.17 with HTTP; Thu, 31 Jan 2008 15:58:42 -0800 (PST) Message-ID: <2379dacc0801311558i6f503dd0nea65963e469afe27@mail.gmail.com> Date: Thu, 31 Jan 2008 17:58:42 -0600 From: "Michael Potter" To: bug-bash@gnu.org MIME-Version: 1.0 X-detected-kernel: by monty-python.gnu.org: Linux 2.6 (newer, 2) Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Subject: SOLUTION: errexit does not exit script in subshells X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 Jan 2008 23:58:47 -0000 Bash Bunch, Here is how I 'solved' the problem: function traperr { echo "ERROR: ${BASH_SOURCE[0]} ${LINENO}" # if BASH_SUBSHELL is 0, then script will exit anyway. if (( $BASH_SUBSHELL >= 1 )) then kill $$ fi } I put solved in quotes because I do not really care for this solution. I hope someone will comment with a graceful solution. -- Michael Potter On Jan 31, 2008 11:43 AM, Michael Potter wrote: > Bash Bunch, > > Not surprisingly, bash does not exit the script when an error is detected > in a subshell. > > I am hopeful that someone has a solution to this (other than: be careful > to not use subshells). > > Here is the test run: > ------------------- > ./subshellnofail.sh > BEGIN > ERROR: ./subshellnofail.sh 10 <- would like the script to stop here. > ONE > ERROR: ./subshellnofail.sh 10 > ------------------- > > Here is the sample script: > ------------------ > #!/bin/bash > > set -o errexit > set -o noclobber > set -o nounset > set -o pipefail # if you fail on this line, get a newer version of > bash. > > function traperr > { > echo "ERROR: ${BASH_SOURCE[0]} ${LINENO}" > # exit 1 # does not seem to affect the program. > # return 1 # does not seem to affect the program. > } > > set -o errtrace > trap traperr ERR > > echo "BEGIN" > > cat /etc/passwd |while read aLine > do > # in a subshell > test=$(true | false | true |false); > done > > echo "ONE" > > while read aLine > do > # not in a subshell > test=$(true | false | true |false); > done > echo "TWO" > > test=$(true | false | true |false); > > echo "END" > > exit 0 > ----------------- > > echo $BASH_VERSION > 3.2.17(1)-release > >