reciproc pipe()

2005-09-02 Thread Robert Millan

Hi!

Is there any way to tell bash to do something like this?  If there isn't, I
think it would be nice to have it (maybe through a builtin or something).

int p1[2];
int p2[2];

pipe(p1);
pipe(p2);

if (fork () == 0)
  {
close (0); dup (p1[0]);
close (1); dup (p2[1]);
exec(whatever);
  }

if (fork () == 0)
  {
close (0); dup (p2[0]);
close (1); dup (p1[1]);
exec(whatever);
  }

I.e, each process communicates with the other via stdin/stdout, and we get the
actual results via stderr.

-- 
Robert Millan


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


Ansi-C backslash expansion: $'n' in a double-quoted string adds single-quote newline single-quote

2005-09-02 Thread Enrique Perez-Terron

Hello,

The command

  echo "${PATH//:/$'\n'}"

yields

  /usr/bin'
  '/bin'
  '/usr/X11R6/bin

while

  newline=$'\n'
  echo "${PATH//:/$newline}"

yields

  /usr/bin
  /bin
  /usr/X11R6/bin

Is this by intention?

  $ bash --version
  GNU bash, version 3.00.16(1)-release (i386-redhat-linux-gnu)
  Copyright (C) 2004 Free Software Foundation, Inc.

By the way, I wish a search for \$\' and \$\" in the man page would turn up 
something for each.
Presently, I only get something for \$\". The hit is the description of the 
"extquote" shopt option.

The form $"string" is described as:

  A  double-quoted string preceded by a dollar sign ($) will cause...

so you don't find it searching for $".

No single-quotes are searchable, because they are represented in the man page 
with the utf byte sequence 342 200 231 octal. I know of no way to generate that 
character with my keyboard. Even cut-n-paste does not work using gnome-terminal 
and less.

The situation is slightly better under info, but there the single quotation 
mark closes every quotation made by the info text itself.  Fortunatly the 
description of the $'string' form is among the first things that turn up when 
searching for $' although there is a risk people will give up thinking there 
will be a zillion places with the three character `$' mentioning the $ 
character.

Regards,
Enrique


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


shopt extquote not working

2005-09-02 Thread Enrique Perez-Terron

Configuration Information [Automatically generated, do not change]:
Machine: i386
OS: linux-gnu
Compiler: i386-redhat-linux-gcc
Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='i386' 
-DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='i386-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 -Wp,-D_FORTIFY_SOURCE=2 
-fexceptions -m32 -march=i386 -mtune=pentium4 -fasynchronous-unwind-tables
uname output: Linux apeiron.home.lan 2.6.12-1.1398_FC4 #1 Fri Jul 15 00:52:32 
EDT 2005 i686 i686 i386 GNU/Linux
Machine Type: i386-redhat-linux-gnu

Bash Version: 3.0
Patch Level: 16
Release Status: release

Description:
The form $'string' does not get expanded if it occurs in
a double-quoted string even if shopt extquote is on.

Repeat-By:
$ shopt -s extquote
$ shopt extquote   # Verify it is "on":
extquoteon
$ echo A__$'\n'__B # Works ok:
A__
__B
$ echo "A__$'\n'__B" # Wrong, should be same as previous:
A__$'\n'__B


Regards, Enrique


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