bash-3.2 parse error

2006-10-12 Thread Greg Schafer
Hi

ncurses-5.5 fails to build with bash-3.2 installed as sh. Here's the
distilled testcase:


cat > testcase << "EOF"
TABSIZE=`grep -v '^[ #]' $CAPS | grep -v "^$" | grep -v "^capalias"| grep -v 
"^infoalias" | wc -l`
EOF

$ bash -n testcase
testcase: line 1: unexpected EOF while looking for matching ``'
testcase: line 2: syntax error: unexpected end of file


It appears to be the `#' character in between the single quotes giving the
grief. That line works with every bash version prior to 3.2. Thoughts?

Thanks
Greg


___
Bug-bash mailing list
Bug-bash@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-bash


logout from interactive subshell

2006-10-12 Thread Com MN PG P E B Consultant 3
Does someone know how to deal with the following situation?

Very often I do the following pattern:

   (1) rlogin to a foreign host
   (2) Invoke a subshell (for example because I'm setting a Clearcase
View)
   (3) Logout from the host

Step (3) needs two steps: First I have to type 'exit' to leave the
subshell,
and then either 'exit' or 'logout' to leave the login shell.

Is it possible to automate this in such a way that I have to type only
one
command, to leave all subshells (in this case, only 1, but in general, I
might be several subshells deep) AND then logout?

One idea would be to use ps, locate the process to the current subshell,
crawling upwards via the PPIDs to find the PID of the login shell, and
kill
it. But this seems to be such an awkward solution, that I thought maybe
there is an easier way to do it.

(Note: This posting goes to the bash and to the zsh mailing list,
because this problem
might be solved differently in both shells, and I'm interested in both
solutions - of
course a solution working in bash AND zsh would be preferable).

Ronald
-- 
Ronald Fischer (phone +49-89-63676431)
mailto:[EMAIL PROTECTED]


___
Bug-bash mailing list
Bug-bash@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-bash


Re: logout from interactive subshell

2006-10-12 Thread Anton Zinoviev
On Thu, Oct 12, 2006 at 10:47:38AM +0200, Com MN PG P E B Consultant 3 wrote:
>(1) rlogin to a foreign host
>(2) Invoke a subshell (for example because I'm setting a Clearcase
> View)
>(3) Logout from the host
> 
> Step (3) needs two steps: First I have to type 'exit' to leave the
> subshell, and then either 'exit' or 'logout' to leave the login shell.

On step (2) you use 

exec bash

instead of just bash.

Anton Zinoviev


___
Bug-bash mailing list
Bug-bash@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-bash


RE: logout from interactive subshell

2006-10-12 Thread Com MN PG P E B Consultant 3
> How about
> function rlogin() {command rlogin "$@"; exit}
> ?

H I don't see how this could help me. Actually, your
solution would EXIT the shell I came from, after the login
has finished!! So I not only have to type all the "exit"s on
the remote host, I would even loose my current shell on the
local host.

Maybe to repeat what I would like to do:

A typical application would go like this:

   rlogin foobar
   DO SOME STUFF
   cleartool setview myview # this creates a subshell
   DO MORE STUFF
   cleartool setview yourview # now I'm two subshells deep
   DO STILL MORE STUFF
   # Now I want to exit
   exit
   exit
   logout

I would like to have a (interactive) command which does the final two
exits plus
a logout for me.

BTW, I could imagine a solution using 'expect', which does the login,
then hands
over the control to the user, and finally if the user is done, performs
the
exit and logout.

Ronald
-- 
Ronald Fischer (phone +49-89-63676431)
mailto:[EMAIL PROTECTED]

 


___
Bug-bash mailing list
Bug-bash@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-bash


Re: logout from interactive subshell

2006-10-12 Thread Andreas Schwab
"Com MN PG P E B Consultant 3" <[EMAIL PROTECTED]>
writes:

> A typical application would go like this:
>
>rlogin foobar
>DO SOME STUFF
>cleartool setview myview # this creates a subshell
>DO MORE STUFF
>cleartool setview yourview # now I'm two subshells deep
>DO STILL MORE STUFF
># Now I want to exit
>exit
>exit
>logout
>
> I would like to have a (interactive) command which does the final two
> exits plus
> a logout for me.

exec cleartool 

Andreas.

-- 
Andreas Schwab, SuSE Labs, [EMAIL PROTECTED]
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."


___
Bug-bash mailing list
Bug-bash@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-bash


Re: logout from interactive subshell

2006-10-12 Thread Vincent Lefevre
On 2006-10-12 10:47:38 +0200, Com MN PG P E B Consultant 3 wrote:
> Does someone know how to deal with the following situation?
> 
> Very often I do the following pattern:
> 
>(1) rlogin to a foreign host
>(2) Invoke a subshell (for example because I'm setting a Clearcase
> View)

Is it a subshell or a second-level shell? (In the first case, $$ and
$PPID remain the same.)

>(3) Logout from the host
> 
> Step (3) needs two steps: First I have to type 'exit' to leave the
> subshell, and then either 'exit' or 'logout' to leave the login
> shell.
> 
> Is it possible to automate this in such a way that I have to type
> only one command, to leave all subshells (in this case, only 1, but
> in general, I might be several subshells deep) AND then logout?
> 
> One idea would be to use ps, locate the process to the current
> subshell, crawling upwards via the PPIDs to find the PID of the
> login shell, and kill it. But this seems to be such an awkward
> solution, that I thought maybe there is an easier way to do it.

You don't need ps. Just get the ppid with $PPID if possible (see
above) or by some other mean (see thread "Subshells and parameters"
in the zsh-users archives). Each subshell can use a trap to be able
to kill its parent. But bash and zsh behave differently concerning
traps.

Alternatively, the command that invokes the subshell could call
'exit' after it has finished (you can write a wrapper, e.g. as a
shell function).

-- 
Vincent Lefèvre <[EMAIL PROTECTED]> - Web: 
100% accessible validated (X)HTML - Blog: 
Work: CR INRIA - computer arithmetic / Arenaire project (LIP, ENS-Lyon)


___
Bug-bash mailing list
Bug-bash@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-bash


RE: logout from interactive subshell

2006-10-12 Thread Com MN PG P E B Consultant 3
> >rlogin foobar
> >DO SOME STUFF
> >cleartool setview myview # this creates a subshell
> >DO MORE STUFF
> >cleartool setview yourview # now I'm two subshells deep
> >DO STILL MORE STUFF
> ># Now I want to exit
> >exit
> >exit
> >logout
> >
> > I would like to have a (interactive) command which does the 
> final two
> > exits plus
> > a logout for me.
> 
> exec cleartool 

I gave "cleartool" just as an example. The point is not that I do not
want
the subshells to NOT be created. In contrary, I *want* to have the
subshells
(and they are not always created by setting a view, but sometimes simply
by invoking "bash" or "zsh" respectively), because I often want to make
changes in the environment, do something, and then undo the changes,
i.e.
go back to the previous state of the environment. But there *are* quite
often
cases that I am deep in a series of interactive subshells, and decide I
do not want to back up one or two levels, but leave all of them and
logout.

So your solution doesn't solve the original problem either

Ronald
-- 
Ronald Fischer (phone +49-89-63676431)
mailto:[EMAIL PROTECTED]


___
Bug-bash mailing list
Bug-bash@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-bash


RE: logout from interactive subshell

2006-10-12 Thread Com MN PG P E B Consultant 3
> >(1) rlogin to a foreign host
> >(2) Invoke a subshell (for example because I'm setting a 
> Clearcase
> > View)
> 
> Is it a subshell or a second-level shell? (In the first case, $$ and
> $PPID remain the same.)

Could you kindly explain the difference? I thought it's always the
same - a process (being the current shell, or cleartool, or whatever)
is doing a fork, followed by an exec of the new shell.

In the particular case of "cleartool setview", I don't know how it is
done, but here is an example of the PIDs:

$ echo $$
25494
$ echo $PPID
25493
$ cleartool setview rofi_dft
$ echo $$
2965
$ echo $PPID
25494

So PPID changed (which I thought is very natural, since I have a new
parent process now).

The same effect appears if I invoke "zsh" instead of "cleartool", so
we have what
you call a "second-level shell".

Now I wonder what exactly would be a "subshell" then

> Each subshell can use a trap to be able
> to kill its parent. But bash and zsh behave differently concerning
> traps.

I can't use traps here, because I know only at "exit time", whether
I want to logout completely, or just go up one level.

> Alternatively, the command that invokes the subshell could call
> 'exit' after it has finished (you can write a wrapper, e.g. as a
> shell function).

Here again, I would need to decide at the time I'm calling the
subshell, what to do at the exit-time so not useful for me
either.

Regards,

Ronald
-- 
Ronald Fischer (phone +49-89-63676431)
mailto:[EMAIL PROTECTED]


___
Bug-bash mailing list
Bug-bash@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-bash


Re: logout from interactive subshell

2006-10-12 Thread Andreas Schwab
"Com MN PG P E B Consultant 3" <[EMAIL PROTECTED]>
writes:

> I can't use traps here, because I know only at "exit time", whether
> I want to logout completely, or just go up one level.

$ call_and_exit() { "$@"; if test $? -eq 42; then exit; fi; }
$ call_and_exit cleartool ...
$ exit 42

Andreas.

-- 
Andreas Schwab, SuSE Labs, [EMAIL PROTECTED]
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."


___
Bug-bash mailing list
Bug-bash@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-bash


RE: logout from interactive subshell

2006-10-12 Thread Com MN PG P E B Consultant 3
> > I can't use traps here, because I know only at "exit time", whether
> > I want to logout completely, or just go up one level.
> 
> $ call_and_exit() { "$@"; if test $? -eq 42; then exit; fi; }
> $ call_and_exit cleartool ...
> $ exit 42

This looks clever. Maybe one should use "exit 42" too in the definition
of call_and_exit
to propagate the exit up, but basically a nice idea. Maybe only
disadvantage that I have
to think before when calling the subshell (either by calling it via
call_and_exit, or
by setting up suitable aliases for cleartool, bash, zsh etc., to do this
automatically)
- I had hoped I cut do this with an intelligent alias which gets me out
of any deep
nesting of subshells without having done any preparation work before.
But your solution
is at least cleaner than the brute-force way of finding the login shell
via ps, and
then killing it.

Will give your idea a thought. Thanks a lot.

Ronald
-- 
Ronald Fischer (phone +49-89-63676431)
mailto:[EMAIL PROTECTED]


___
Bug-bash mailing list
Bug-bash@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-bash


RE: logout from interactive subshell

2006-10-12 Thread Com MN PG P E B Consultant 3
> >(1) rlogin to a foreign host
> >(2) Invoke a subshell (for example because I'm setting a 
> Clearcase
> > View)
> >(3) Logout from the host
> > 
> > Step (3) needs two steps: First I have to type 'exit' to leave the
> > subshell, and then either 'exit' or 'logout' to leave the 
> login shell.
> 
> On step (2) you use 
> 
> exec bash
> 
> instead of just bash.

This does not work in the general case since I don't know at the time of
invoking
bash, whether I will eventually just go back one level or logout
completely. 
Imagine the following situation:

  rlogin foo
  VAR=val1
  exec bash
  VAR=val2

Now if at this point I would decide to not logout, but just go up one
level (in order
to have the old value of VAR restored), there is no way to do it -
typing exit would
log me out *unconditionally*.

Ronald
-- 
Ronald Fischer (phone +49-89-63676431)
mailto:[EMAIL PROTECTED]


___
Bug-bash mailing list
Bug-bash@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-bash


Bash-3.2 available for FTP

2006-10-12 Thread Chet Ramey
Introduction


The first public release of bash-3.2 is now available with the URLs

ftp://ftp.cwru.edu/pub/bash/bash-3.2.tar.gz
ftp://ftp.gnu.org/pub/gnu/bash/bash-3.2.tar.gz

and from the usual GNU mirror sites.

This tar file does not include the formatted documentation
(postscript, dvi, html, and nroffed versions of the manual pages);
that may be retrieved with the URLs

ftp://ftp.cwru.edu/pub/bash/bash-doc-3.2.tar.gz
ftp://ftp.gnu.org/pub/gnu/bash/bash-doc-3.2.tar.gz

When unpacking the documentation, make sure to extract the tar file
in the bash-3.2 source directory.

Diffs from bash-3.1 are not available.

Please use `bashbug' to report bugs with this version.  It is built
and installed at the same time as bash.

Installation


Please read the README file first.

Installation instructions are provided in the INSTALL file.

New Features


This is the second maintenance release for the third major release of bash.

This release fixes the relatively few remaining bugs in the bash3 line.
It will probably be the final release before bash version 4.

Read the file NEWS in the bash-3.2 distribution for a complete description
of the new features.

Changes have been made to the Readline library being released at
the same time as bash-3.2, readline-5.2, so that Bash can be
linked against an already-installed Readline library rather than
the private version in lib/readline.  Only readline-5.1 and later
versions are able to provide all of the symbols that bash-3.2
requires; earlier versions of the Readline library will not work
correctly.

A complete list of changes between bash-3.1 and bash-3.2 is
available in the file CHANGES; the relevant portions are appended.

Readline


Also available is a new release of the standalone Readline library,
version 5.2, with its own configuration scripts and Makefiles. 
It can be retrieved with the URLs

ftp://ftp.cwru.edu/pub/bash/readline-5.2.tar.gz
ftp://ftp.gnu.org/pub/gnu/readline/readline-5.2.tar.gz

and from the usual GNU mirror sites.

Diffs from readline-5.1 are not available.

The formatted Readline documentation is included in the readline
distribution tar file.

A separate announcement listing the changes in Readline is being
distributed.

As always, thanks for your help.

Chet

+== CHANGES ==+
This document details the changes between this version, bash-3.2-release,
and the previous version, bash-3.2-beta.

1.  Changes to Bash

a.  Fixed a bug that caused the temporary environment passed to a command to
affect the shell's environment under certain circumstances.

b.  Fixed a bug in the printf builtin that caused the %q format specifier to
ignore empty string arguments.

c.  Improved multibyte character environment detection at configuration time.

d.  Fixed a bug in the read builtin that left spurious escape characters in the
input after processing backslashes when assigning to an array variable.

2.  Changes to Readline

a.  Fixed a redisplay bug that occurred in multibyte-capable locales when the
prompt was one character longer than the screen width.
--
This document details the changes between this version, bash-3.2-beta,
and the previous version, bash-3.2-alpha.

1.  Changes to Bash

a.  Changed the lexical analyzer to treat locale-specific blank characters as
white space.

b.  Fixed a bug in command printing to avoid confusion between redirections and
process substitution.

c.  Fixed problems with cross-compiling originating from inherited environment
variables.

d.  Added write error reporting to printf builtin.

e.  Fixed a bug in the variable expansion code that could cause a core dump in
a multi-byte locale.

f.  Fixed a bug that caused substring expansion of a null string to return
incorrect results.

g.  BASH_COMMAND now retains its previous value while executing commands as the
result of a trap, as the documentation states.

2.  Changes to Readline

a.  Fixed a bug with prompt redisplay in a multi-byte locale to avoid redrawing
the prompt and input line multiple times.

b.  Fixed history expansion to not be confused by here-string redirection.

c.  Readline no longer treats read errors by converting them to newlines, as
it does with EOF.  This caused partial lines to be returned from readline().

--
This document details the changes between this version, bash-3.2-alpha,
and the previous version, bash-3.1-release.

1.  Changes to Bash

a.  Fixed a source bug that caused the minimal configuration to not compile.

b.  Fixed memory leaks in error handling for the `read' builtin.

c.  Changed the [[ and (( compound commands to set PIPESTATUS with their exit
status.

d.  Fixed some parsing problems with compound array assignments.

e.  Added additional configuration changes for: NetBSD (incomplete m

Readline-5.2 available for FTP

2006-10-12 Thread Chet Ramey
The first public release of the GNU Readline library, version
5.2, is now available for FTP with the URLs

ftp://ftp.cwru.edu/pub/bash/readline-5.2.tar.gz
ftp://ftp.gnu.org/pub/gnu/readline/readline-5.2.tar.gz

and from the usual GNU mirror sites.

This distribution is essentially a standalone version of the
readline library that appears in Bash-3.2 together with an
`autoconf' framework.  The documentation has been updated and
is current.  Postscript, DVI, and Info versions of the Readline
and History manuals are included.  A list of changes in this
release is appended to this announcement.

GNU Readline is a library which provides programs with an input
facility including command-line editing and history.  Editing
commands similar to both emacs and vi are included.  The GNU
History library, which provides facilities for managing a list of
previously-typed command lines and an interactive command line
recall facility similar to that provided by csh, is also present.
The history library is built as part of the readline library as well
as separately.

Diffs from readline-5.1 are not available.

Please send readline bug reports to [EMAIL PROTECTED]

+== CHANGES ==+
This document details the changes between this version, readline-5.2,
and the previous version, readline-5.1.

1.  Changes to Readline

a.  Fixed a problem that caused segmentation faults when using readline in
callback mode and typing consecutive DEL characters on an empty line.

b.  Fixed several redisplay problems with multibyte characters, all having to
do with the different code paths and variable meanings between single-byte
and multibyte character redisplay.

c.  Fixed a problem with key sequence translation when presented with the
sequence \M-\C-x.

d.  Fixed a problem that prevented the `a' command in vi mode from being
undone and redone properly.

e.  Fixed a problem that prevented empty inserts in vi mode from being undone
properly.

f.  Fixed a problem that caused readline to initialize with an incorrect idea
of whether or not the terminal can autowrap.

g.  Fixed output of key bindings (like bash `bind -p') to honor the setting of
convert-meta and use \e where appropriate.

h.  Changed the default filename completion function to call the filename
dequoting function if the directory completion hook isn't set.  This means
that any directory completion hooks need to dequote the directory name,
since application-specific hooks need to know how the word was quoted,
even if no other changes are made.

i.  Fixed a bug with creating the prompt for a non-interactive search string
when there are non-printing characters in the primary prompt.

j.  Fixed a bug that caused prompts with invisible characters to be redrawn
multiple times in a multibyte locale.

k.  Fixed a bug that could cause the key sequence scanning code to return the
wrong function.

l.  Fixed a problem with the callback interface that caused it to fail when
using multi-character keyboard macros.

m.  Fixed a bug that could cause a core dump when an edited history entry was
re-executed under certain conditions.

n.  Fixed a bug that caused readline to reference freed memory when attmpting
to display a portion of the prompt.

o.  Fixed a bug with prompt redisplay in a multi-byte locale to avoid redrawing
the prompt and input line multiple times.

p.  Fixed history expansion to not be confused by here-string redirection.

q.  Readline no longer treats read errors by converting them to newlines, as
it does with EOF.  This caused partial lines to be returned from readline().

r.  Fixed a redisplay bug that occurred in multibyte-capable locales when the
prompt was one character longer than the screen width.

2.  New Features in Readline

a.  Calling applications can now set the keyboard timeout to 0, allowing
poll-like behavior.

b.  The value of SYS_INPUTRC (configurable at compilation time) is now used as
the default last-ditch startup file.

c.  The history file reading functions now allow windows-like \r\n line
terminators.

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
   Live Strong.  No day but today.
Chet Ramey, ITS, CWRU[EMAIL PROTECTED]http://cnswww.cns.cwru.edu/~chet/


___
Bug-bash mailing list
Bug-bash@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-bash


Re: Bash-3.2 available for FTP

2006-10-12 Thread Anton Zinoviev
On Thu, Oct 12, 2006 at 09:29:33AM -0400, Chet Ramey wrote:
> Introduction
> 
> 
> The first public release of bash-3.2 is now available with the URLs

Is this version supposed to use the Translation Project
?

The last bash version submitted to the Translatin Project was 3.0.  If
you don't want to use the Translation Project, please write the
coordinator ([EMAIL PROTECTED]) to remove Bash from the
supported textual domains.  Otherwise please submit the new po-file at
least 1-2 weeks prior to the final release in order to give
translators some chance to complete the work.

Anton Zinoviev


___
Bug-bash mailing list
Bug-bash@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-bash


Re: bash-3.2 parse error

2006-10-12 Thread Chet Ramey
Greg Schafer wrote:
> Hi
> 
> ncurses-5.5 fails to build with bash-3.2 installed as sh. Here's the
> distilled testcase:
> 
> 
> cat > testcase << "EOF"
> TABSIZE=`grep -v '^[ #]' $CAPS | grep -v "^$" | grep -v "^capalias"| grep -v 
> "^infoalias" | wc -l`
> EOF
> 
> $ bash -n testcase
> testcase: line 1: unexpected EOF while looking for matching ``'
> testcase: line 2: syntax error: unexpected end of file
> 
> 
> It appears to be the `#' character in between the single quotes giving the
> grief. That line works with every bash version prior to 3.2. Thoughts?

I'll look into it.

Chet
-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
   Live Strong.  No day but today.
Chet Ramey, ITS, CWRU[EMAIL PROTECTED]http://cnswww.cns.cwru.edu/~chet/


___
Bug-bash mailing list
Bug-bash@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-bash


Re: bash 3.2 match operator problem

2006-10-12 Thread Chet Ramey
> Machine Type: i586-pc-linux-gnu
> 
> Bash Version: 3.2
> Patch Level: 0
> Release Status: release
> 
> Description:
>   I just upgraded to bash 3.2 and my scripts quit working for matching.
> The test case below will say 'Life is good' in bash 3.1.17, but on bash
> 3.2 I get 'Upgrade of doom returns 2 from match' instead.
[...]
> [[ "${OLDCANDIDATE}" =~ "([^-]+)-([^-]+)-([^-]+)-0*([1-9][0-9]*)\.tgz" ]]

This is from the list of new features in bash-3.2:

f.  Quoting the string argument to the [[ command's  =~ operator now forces   
string matching, as with the other pattern-matching operators.

The change was made for consistency -- without it, there is no way to have
the string matched without regard to characters significant to the matcher.

Chet


-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
Live Strong.
Chet Ramey, ITS, CWRU[EMAIL PROTECTED]http://tiswww.tis.case.edu/~chet/


___
Bug-bash mailing list
Bug-bash@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-bash


Re: bash 3.2 match operator problem

2006-10-12 Thread John Gatewood Ham

Thank you for your reply.

I removed the quotes and the script crashes.  There must be more
required to convert my code and I hope someone will help.  It is
only 1 line, and once I know the new rules I can convert everything
else on my own.  I get this when just removing teh quotes on the
right hand side:

testcase running under 3.2.0(2)-release
testcase: line 6: unexpected argument `(' to conditional binary operator
testcase: line 6: syntax error near `(['
testcase: line 6: `[[ "${OLDCANDIDATE}" =~ 
([^-]+)-([^-]+)-([^-]+)-0*([1-9][0-9]*)\.tgz ]]'

I had several responses that said "just remove the quotes" but I don't
think any of them removed the quotes themselves and tried running the
supplied test case.  Did the supplied test case (after removing those
quotes) work for you with bash 3.2 ?  Work means print 'Life is good'.

JGH

On Thu, 12 Oct 2006, Chet Ramey wrote:


Machine Type: i586-pc-linux-gnu

Bash Version: 3.2
Patch Level: 0
Release Status: release

Description:
  I just upgraded to bash 3.2 and my scripts quit working for matching.
The test case below will say 'Life is good' in bash 3.1.17, but on bash
3.2 I get 'Upgrade of doom returns 2 from match' instead.

[...]

[[ "${OLDCANDIDATE}" =~ "([^-]+)-([^-]+)-([^-]+)-0*([1-9][0-9]*)\.tgz" ]]


This is from the list of new features in bash-3.2:

f.  Quoting the string argument to the [[ command's  =~ operator now forces
   string matching, as with the other pattern-matching operators.

The change was made for consistency -- without it, there is no way to have
the string matched without regard to characters significant to the matcher.

Chet


--
``The lyf so short, the craft so long to lerne.'' - Chaucer
Live Strong.
Chet Ramey, ITS, CWRU[EMAIL PROTECTED]http://tiswww.tis.case.edu/~chet/




___
Bug-bash mailing list
Bug-bash@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-bash


Re: bash 3.2 match operator problem

2006-10-12 Thread Andreas Schwab
John Gatewood Ham <[EMAIL PROTECTED]> writes:

> Thank you for your reply.
>
> I removed the quotes and the script crashes.  There must be more
> required to convert my code and I hope someone will help.  It is
> only 1 line, and once I know the new rules I can convert everything
> else on my own.  I get this when just removing teh quotes on the
> right hand side:
>
> testcase running under 3.2.0(2)-release
> testcase: line 6: unexpected argument `(' to conditional binary operator
> testcase: line 6: syntax error near `(['
> testcase: line 6: `[[ "${OLDCANDIDATE}" =~ 
> ([^-]+)-([^-]+)-([^-]+)-0*([1-9][0-9]*)\.tgz ]]'

Parens are special inside [[ ]], you need to quote them.

Andreas.

-- 
Andreas Schwab, SuSE Labs, [EMAIL PROTECTED]
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."


___
Bug-bash mailing list
Bug-bash@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-bash


Re: bash 3.2 match operator problem

2006-10-12 Thread John Gatewood Ham

Ok, here is a smaller 3 line test case.  I have attempted to handle
the parenthesis as you instructed.  Under bash 3.0.17 BASH_REMATCH
gets the 4 pieces.  Under bash 3.2 I only get BASH_REMATCH=()
True, it no longer crashes.  But it doesn't work either...

#!/bin/bash
[[ jbig2dec-0.9-i586-001.tgz =~ 
\([^-]+\)-\([^-]+\)-\([^-]+\)-0*\([1-9][0-9]*\)\.tgz ]]
set | grep BASH_REMATCH

On Thu, 12 Oct 2006, Andreas Schwab wrote:


John Gatewood Ham <[EMAIL PROTECTED]> writes:


Thank you for your reply.

I removed the quotes and the script crashes.  There must be more
required to convert my code and I hope someone will help.  It is
only 1 line, and once I know the new rules I can convert everything
else on my own.  I get this when just removing the quotes on the
right hand side:

testcase running under 3.2.0(2)-release
testcase: line 6: unexpected argument `(' to conditional binary operator
testcase: line 6: syntax error near `(['
testcase: line 6: `[[ "${OLDCANDIDATE}" =~ 
([^-]+)-([^-]+)-([^-]+)-0*([1-9][0-9]*)\.tgz ]]'


Parens are special inside [[ ]], you need to quote them.

Andreas.



___
Bug-bash mailing list
Bug-bash@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-bash


Re: bash 3.2 match operator problem

2006-10-12 Thread Chet Ramey
> Ok, here is a smaller 3 line test case.  I have attempted to handle
> the parenthesis as you instructed.  Under bash 3.0.17 BASH_REMATCH
> gets the 4 pieces.  Under bash 3.2 I only get BASH_REMATCH=()
> True, it no longer crashes.  But it doesn't work either...

I understand the problem, and have to consider the best solution.  It
appears that this will require a change to the shell parser, since [[
is part of the grammar.

Chet

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
Live Strong.
Chet Ramey, ITS, CWRU[EMAIL PROTECTED]http://tiswww.tis.case.edu/~chet/


___
Bug-bash mailing list
Bug-bash@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-bash


Re: logout from interactive subshell

2006-10-12 Thread Matthew Woehlke

Com MN PG P E B Consultant 3 wrote:

Does someone know how to deal with the following situation?

Very often I do the following pattern:

   (1) rlogin to a foreign host
   (2) Invoke a subshell (for example because I'm setting a Clearcase
View)
   (3) Logout from the host

Step (3) needs two steps: First I have to type 'exit' to leave the
subshell,
and then either 'exit' or 'logout' to leave the login shell.

Is it possible to automate this in such a way that I have to type only
one command, to leave all subshells (in this case, only 1, but in
general, I might be several subshells deep) AND then logout?


What about in your login (.bash_profile, etc) exporting a variable, say 
ROOT_PID=$$ and having a command/function/alias 'kill -s SIGHUP 
$ROOT_PID'? This is equivalent to killing the rlogin connection, but 
should clean up nicely if all you have are shells.


--
Matthew
"I don't question your existence -- God" (seen on a church billboard)



___
Bug-bash mailing list
Bug-bash@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-bash


Re: logout from interactive subshell

2006-10-12 Thread Mike Stroyan

Very often I do the following pattern:

   (1) rlogin to a foreign host
   (2) Invoke a subshell (for example because I'm setting a Clearcase
View)
   (3) Logout from the host

Step (3) needs two steps: First I have to type 'exit' to leave the
subshell,
and then either 'exit' or 'logout' to leave the login shell.

Is it possible to automate this in such a way that I have to type only
one command, to leave all subshells (in this case, only 1, but in
general, I might be several subshells deep) AND then logout?


 This shouldn't be a shell question at all.  It is an rlogin question.
Type ~. to make rlogin to close the connection.  The shells will
all exit in response to that.  (And you can do the same with ssh,
which you should be using instead of rlogin.)

--
Mike Stroyan
[EMAIL PROTECTED]


___
Bug-bash mailing list
Bug-bash@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-bash


[patch] touchup ulimit docs in bash-3.2

2006-10-12 Thread Mike Frysinger
looks like the latest release is missing just 1 last thing in the ulimit 
documentation with the new rlimit features ... patch attached
-mike


pgpYzDtWR3t3W.pgp
Description: PGP signature
add missing docs for -e and -r options

--- builtins/ulimit.def
+++ builtins/ulimit.def
@@ -24,7 +24,7 @@
 $BUILTIN ulimit
 $FUNCTION ulimit_builtin
 $DEPENDS_ON !_MINIX
-$SHORT_DOC ulimit [-SHacdfilmnpqstuvx] [limit]
+$SHORT_DOC ulimit [-SHacdefilmnpqrstuvx] [limit]
 Ulimit provides control over the resources available to processes
 started by the shell, on systems that allow such control.  If an
 option is given, it is interpreted as follows:
___
Bug-bash mailing list
Bug-bash@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-bash


Re: bash 3.2 match operator problem

2006-10-12 Thread John Gatewood Ham

Ok, so at least I'm not crazy; there is some kind of bug.
When you have a patch I'm eager to help test it.

Thank you,

JGH

On Thu, 12 Oct 2006, Chet Ramey wrote:


Ok, here is a smaller 3 line test case.  I have attempted to handle
the parenthesis as you instructed.  Under bash 3.0.17 BASH_REMATCH
gets the 4 pieces.  Under bash 3.2 I only get BASH_REMATCH=()
True, it no longer crashes.  But it doesn't work either...


I understand the problem, and have to consider the best solution.  It
appears that this will require a change to the shell parser, since [[
is part of the grammar.

Chet



___
Bug-bash mailing list
Bug-bash@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-bash


RE: logout from interactive subshell

2006-10-12 Thread Com MN PG P E B Consultant 3
> What about in your login (.bash_profile, etc) exporting a 
> variable, say 
> ROOT_PID=$$ and having a command/function/alias 'kill -s SIGHUP 
> $ROOT_PID'? This is equivalent to killing the rlogin connection, but 
> should clean up nicely if all you have are shells.

Excellent idea! Thank you for this suggestion.

Ronald
-- 
Ronald Fischer (phone +49-89-63676431)
mailto:[EMAIL PROTECTED]


___
Bug-bash mailing list
Bug-bash@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-bash