Re: Use of pipe in $( filename | program) returns null

2009-11-28 Thread Bernd Eggink

Am 28.11.2009 06:35, schrieb r...@saturn.syslang.net:


Description:
use of $(  filename | program) does not work. It either should or it 
should be properly documented.
The problem also happens on bash4.

Repeat-By:

qq=$(  /etc/passwd | grep sys)
echo $qq
# result is null

Fix:
Either fix the docs to tell people that a pipe is not allowed or fix 
the code to allow it.


The problem is not the pipe but the fact that 'filename' is an empty 
command which does nothing. If you want 'program' to read from 'file', 
use 'programfile'.


Bernd

--
Bernd Eggink
http://sudrala.de




Re: Use of pipe in $( filename | program) returns null

2009-11-28 Thread Andreas Schwab
Bernd Eggink mono...@sudrala.de writes:

 Am 28.11.2009 06:35, schrieb r...@saturn.syslang.net:

 Description:
  use of $(  filename | program) does not work. It either should or it 
 should be properly documented.
  The problem also happens on bash4.

 Repeat-By:

  qq=$(  /etc/passwd | grep sys)
  echo $qq
  # result is null

 Fix:
  Either fix the docs to tell people that a pipe is not allowed or fix 
 the code to allow it.

 The problem is not the pipe but the fact that 'filename' is an empty
 command which does nothing. If you want 'program' to read from 'file', use
 programfile'.

Or even $( /etc/passwd grep sys).

Andreas.

-- 
Andreas Schwab, sch...@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
And now for something completely different.




PROMPT_DIRTRIM skips depth n-1 when ~ is n

2009-11-28 Thread dennis
Configuration Information [Automatically generated, do not change]:Machine: 
i486OS: linux-gnuCompiler: gccCompilation CFLAGS:  -DPROGRAM='bash' 
-DCONF_HOSTTYPE='i486' -DCONF_OSTYPE='lin$uname output: Linux emperor 
2.6.31-14-generic #48-Ubuntu SMP Fri Oct 16 14:04:2$Machine Type: 
i486-pc-linux-gnu
Bash Version: 4.0Patch Level: 33Release Status: release
Description:
If you are in a directory below ~ and you set PROMPT_DIRTRIM to the 
depthminus 2 it includes the depth minus 1 directory in the prompt as 
well.
Repeat-By:
$ mkdir -p /tmp/seven/six/five/four/three/two/one$ cd 
/tmp/seven/six/five/four/three/two/one$ PS1=\w$ 
/tmp/seven/six/five/four/three/two/one$ 
PROMPT_DIRTRIM=0/tmp/seven/six/five/four/three/two/one$ 
PROMPT_DIRTRIM=1.../one$ PROMPT_DIRTRIM=2.../two/one$ 
PROMPT_DIRTRIM=3.../three/two/one$ PROMPT_DIRTRIM=4.../four/three/two/one$ 
PROMPT_DIRTRIM=5.../five/four/three/two/one$ 
PROMPT_DIRTRIM=6.../six/five/four/three/two/one$ 
PROMPT_DIRTRIM=7.../seven/six/five/four/three/two/one$ 
PROMPT_DIRTRIM=8/tmp/seven/six/five/four/three/two/one$ cd ~~$ mkdir -p 
~/seven/six/five/four/three/two/one~$ cd 
~/seven/six/five/four/three/two/one~/seven/six/five/four/three/two/one$ 
PROMPT_DIRTRIM=0~/seven/six/five/four/three/two/one$ 
PROMPT_DIRTRIM=1~/.../one$ PROMPT_DIRTRIM=2~/.../two/one$ 
PROMPT_DIRTRIM=3~/.../three/two/one$ 
PROMPT_DIRTRIM=4~/.../four/three/two/one$ 
PROMPT_DIRTRIM=5~/.../five/four/three/two/one$ 
PROMPT_DIRTRIM=6~/seven/six/five/four/three/two/one$

Repeated here without the prompts:
mkdir -p /tmp/seven/six/five/four/three/two/onecd 
/tmp/seven/six/five/four/three/two/onePS1=\w$ 
PROMPT_DIRTRIM=0PROMPT_DIRTRIM=1PROMPT_DIRTRIM=2PROMPT_DIRTRIM=3PROMPT_DIRT
RIM=4PROMPT_DIRTRIM=5PROMPT_DIRTRIM=6PROMPT_DIRTRIM=7PROMPT_DIRTRIM=8cd 
~mkdir -p ~/seven/six/five/four/three/two/onecd 
~/seven/six/five/four/three/two/onePROMPT_DIRTRIM=0PROMPT_DIRTRIM=1PROMPT_DI
RTRIM=2PROMPT_DIRTRIM=3PROMPT_DIRTRIM=4PROMPT_DIRTRIM=5PROMPT_DIRTRIM=6



( error

2009-11-28 Thread Antonio Macchi

$ hd (echo -en \\0{0..3}{0..7}{0..7})


it breaks the console.




Re: ESC SPC please

2009-11-28 Thread Pierre Gaston

On Sat, 28 Nov 2009, jida...@jidanni.org wrote:


Please implement emacs'

 M-SPC (translated from escape SPC) runs the command just-one-space,
 which is an interactive compiled Lisp function in `simple.el'.

I mean you already implement

 M-\ (translated from escape \) runs the command
 delete-horizontal-space, which is an interactive compiled Lisp
 function in `simple.el'.

Sorry I make this request every two years.



maybe try the following macro:

bind  '\M- :\M-\\ '




Re: ( error

2009-11-28 Thread Pierre Gaston


On Sat, 28 Nov 2009, Antonio Macchi wrote:


$ hd (echo -en \\0{0..3}{0..7}{0..7})


it breaks the console.




The behaviour of bash with this construct
has changed between 3.x and 4.x so maybe indicate the version
you are using (or just use bug-bash)

Also perhaps indicate what you want to achieve (I don't have an
hd command, and didn't find a man page after a quick search)
and give a more precise description of breaks the console




Re: ( error

2009-11-28 Thread Antonio Macchi

Also perhaps indicate what you want to achieve (I don't have an
hd command, and didn't find a man page after a quick search)


sorry.. i'll be more precise in future...

but, if you don't have hd (hexdump) how can you see the content of a, 
for example, strange file


i mean

$ ls -l
total 0
-rw-r--r-- 1 user1 user1 0 2009-11-28 14:56 ?

$ hd (ls)
  09 0a |..|
0002

$ rm $'\x09'

$ ls -l
total 0



do you know another way to do it?





Re: ( error

2009-11-28 Thread Eric Blake
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

According to Antonio Macchi on 11/28/2009 6:57 AM:
 but, if you don't have hd (hexdump) how can you see the content of a,

POSIX requires the existence of od, and od can be used to emulate hexdump.
 You are very unlikely to find a system that lacks od.

- --
Don't work too hard, make some time for fun as well!

Eric Blake e...@byu.net
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.9 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAksRLgQACgkQ84KuGfSFAYCllACgmXmsY/NSw10lNQp8kMwKfzA2
yP0AoIs97ThyBmAPxe20sQyhUcKCaRyx
=I0T9
-END PGP SIGNATURE-




Re: ( error

2009-11-28 Thread Jan Schampera
Antonio Macchi schrieb:
 $ hd (echo -en \\0{0..3}{0..7}{0..7})
 
 
 it breaks the console.
 
 


It doesn't break the console, it crashes the shell (here with a
subshell to get the text):


bon...@core:~$ bash
bon...@core:~$ hd (echo -en \\0{0..3}{0..7}{0..7})

malloc: ../bash/subst.c:4198: assertion botched
realloc: start and end chunk sizes differ
last command: hd (echo -en \\0{0..3}{0..7}{0..7})
Aborting...Abgebrochen (core dumped)




Re: Use of pipe in $( filename | program) returns null

2009-11-28 Thread DennisW
On Nov 28, 4:46 am, Andreas Schwab sch...@linux-m68k.org wrote:
 Bernd Eggink mono...@sudrala.de writes:
  Am 28.11.2009 06:35, schrieb r...@saturn.syslang.net:

  Description:
         use of $(  filename | program) does not work. It either should or 
  it should be properly documented.
         The problem also happens on bash4.

  Repeat-By:

         qq=$(  /etc/passwd | grep sys)
         echo $qq
         # result is null

  Fix:
         Either fix the docs to tell people that a pipe is not allowed or 
  fix the code to allow it.

  The problem is not the pipe but the fact that 'filename' is an empty
  command which does nothing. If you want 'program' to read from 'file', use
  programfile'.

 Or even $( /etc/passwd grep sys).

 Andreas.

 --
 Andreas Schwab, sch...@linux-m68k.org
 GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
 And now for something completely different.

Or even $(grep sys /etc/passwd)


Re: Cannot build statically linked, working bash

2009-11-28 Thread Chet Ramey
tho...@koeller.dyndns.org wrote:

 Description:
   I failed at building a statically linked, working bash. First of all, 
 the only way to build is
 by giving the '--with-bash-malloc=no' argument to configure, because 
 otherwise the linker will
 complain about multiple definitions of 'malloc' and 'free', which of 
 course are present in libc.
 Even so, the binary resulting from the build will crash during 
 startup, inside the getpwuid()
 function. I found a mail thread that describes a similar problem for 
 bash-3.2 on Solaris
 http://lists.gnu.org/archive/html/bug-bash/2008-10/msg00011.html. 
 Like the reporter, I configured
 my system to use LDAP for authentication. Only if I run bash as the 
 root user, which is a local
 account outside the ldap directory, there is no crash and it appears 
 to work.

It's the same problem.  There are portions of the Linux C library that
cannot be used by a statically-linked program.  The best you can do is
to link those portions dynamically and the remainder statically.

Chet
-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRUc...@case.eduhttp://cnswww.cns.cwru.edu/~chet/




Re: Use of pipe in $( filename | program) returns null

2009-11-28 Thread Chet Ramey
r...@saturn.syslang.net wrote:

 Description:
   use of $( filename | program) does not work. It either should or it 
 should be properly documented.
   The problem also happens on bash4.
 
 Repeat-By:
 
   qq=$( /etc/passwd | grep sys)
   echo $qq
   # result is null
 
 Fix:
   Either fix the docs to tell people that a pipe is not allowed or fix 
 the code to allow it.

That construct is very limited.  As the bash man page says:

The command substitution $(cat file) can be replaced by the equivalent
but faster $( file).

That seems pretty clear.

Chet

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRUc...@case.eduhttp://cnswww.cns.cwru.edu/~chet/




Re: ( error

2009-11-28 Thread Chet Ramey
Antonio Macchi wrote:
 $ hd (echo -en \\0{0..3}{0..7}{0..7})
 
 
 it breaks the console.

This was a bug in bash-3.2; fixed in bash-4.0.  You hit it when you
get close to exceeding the max number of open file descriptors using
the /dev/fd version of process substitution.

Chet
-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRUc...@case.eduhttp://cnswww.cns.cwru.edu/~chet/




Re: ESC SPC please

2009-11-28 Thread jidanni
PG maybe try the following macro:
PG bind  '\M- :\M-\\ '
Sorry, that doesn't work on the command line or .inputrc.
No effect.




Re: PROMPT_DIRTRIM skips depth n-1 when ~ is n

2009-11-28 Thread DennisW
On Nov 28, 5:25 am, dennis den...@netstrata.com wrote:
 Configuration Information [Automatically generated, do not change]:Machine:
 i486OS: linux-gnuCompiler: gccCompilation CFLAGS:  -DPROGRAM='bash'
 -DCONF_HOSTTYPE='i486' -DCONF_OSTYPE='lin$uname output: Linux emperor
 2.6.31-14-generic #48-Ubuntu SMP Fri Oct 16 14:04:2$Machine Type:
 i486-pc-linux-gnu
 Bash Version: 4.0Patch Level: 33Release Status: release
 Description:
 If you are in a directory below ~ and you set PROMPT_DIRTRIM to the
 depthminus 2 it includes the depth minus 1 directory in the prompt as
 well.
 Repeat-By:
 $ mkdir -p /tmp/seven/six/five/four/three/two/one$ cd
 /tmp/seven/six/five/four/three/two/one$ PS1=\w$
 /tmp/seven/six/five/four/three/two/one$
 PROMPT_DIRTRIM=0/tmp/seven/six/five/four/three/two/one$
 PROMPT_DIRTRIM=1.../one$ PROMPT_DIRTRIM=2.../two/one$
 PROMPT_DIRTRIM=3.../three/two/one$ PROMPT_DIRTRIM=4.../four/three/two/one$
 PROMPT_DIRTRIM=5.../five/four/three/two/one$
 PROMPT_DIRTRIM=6.../six/five/four/three/two/one$
 PROMPT_DIRTRIM=7.../seven/six/five/four/three/two/one$
 PROMPT_DIRTRIM=8/tmp/seven/six/five/four/three/two/one$ cd ~~$ mkdir -p
 ~/seven/six/five/four/three/two/one~$ cd
 ~/seven/six/five/four/three/two/one~/seven/six/five/four/three/two/one$
 PROMPT_DIRTRIM=0~/seven/six/five/four/three/two/one$
 PROMPT_DIRTRIM=1~/.../one$ PROMPT_DIRTRIM=2~/.../two/one$
 PROMPT_DIRTRIM=3~/.../three/two/one$
 PROMPT_DIRTRIM=4~/.../four/three/two/one$
 PROMPT_DIRTRIM=5~/.../five/four/three/two/one$
 PROMPT_DIRTRIM=6~/seven/six/five/four/three/two/one$

 Repeated here without the prompts:
 mkdir -p /tmp/seven/six/five/four/three/two/onecd
 /tmp/seven/six/five/four/three/two/onePS1=\w$
 PROMPT_DIRTRIM=0PROMPT_DIRTRIM=1PROMPT_DIRTRIM=2PROMPT_DIRTRIM=3PROMPT_DIR T
 RIM=4PROMPT_DIRTRIM=5PROMPT_DIRTRIM=6PROMPT_DIRTRIM=7PROMPT_DIRTRIM=8cd
 ~mkdir -p ~/seven/six/five/four/three/two/onecd
 ~/seven/six/five/four/three/two/onePROMPT_DIRTRIM=0PROMPT_DIRTRIM=1PROMPT_D I
 RTRIM=2PROMPT_DIRTRIM=3PROMPT_DIRTRIM=4PROMPT_DIRTRIM=5PROMPT_DIRTRIM=6

Once again, something - probably Linux vs. Windows line endings -
screwed up my post. Here it is straightened out. Hopefully.

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 emperor 2.6.31-14-generic #48-Ubuntu SMP Fri Oct
16 14:04:26 UTC 2009 i686 GNU/Linux
Machine Type: i486-pc-linux-gnu

Bash Version: 4.0
Patch Level: 33
Release Status: release

Description:

If you are in a directory below ~ and you set PROMPT_DIRTRIM to the
depth
minus 2 it includes the depth minus 1 directory in the prompt as well.

Repeat-By:

$ mkdir -p /tmp/seven/six/five/four/three/two/one
$ cd /tmp/seven/six/five/four/three/two/one
$ PS1=\w$ 
/tmp/seven/six/five/four/three/two/one$ PROMPT_DIRTRIM=0
/tmp/seven/six/five/four/three/two/one$ PROMPT_DIRTRIM=1
.../one$ PROMPT_DIRTRIM=2
.../two/one$ PROMPT_DIRTRIM=3
.../three/two/one$ PROMPT_DIRTRIM=4
.../four/three/two/one$ PROMPT_DIRTRIM=5
.../five/four/three/two/one$ PROMPT_DIRTRIM=6
.../six/five/four/three/two/one$ PROMPT_DIRTRIM=7
.../seven/six/five/four/three/two/one$ PROMPT_DIRTRIM=8
/tmp/seven/six/five/four/three/two/one$ cd ~
~$ mkdir -p ~/seven/six/five/four/three/two/one
~$ cd ~/seven/six/five/four/three/two/one
~/seven/six/five/four/three/two/one$ PROMPT_DIRTRIM=0
~/seven/six/five/four/three/two/one$ PROMPT_DIRTRIM=1
~/.../one$ PROMPT_DIRTRIM=2
~/.../two/one$ PROMPT_DIRTRIM=3
~/.../three/two/one$ PROMPT_DIRTRIM=4
~/.../four/three/two/one$ PROMPT_DIRTRIM=5
~/.../five/four/three/two/one$ PROMPT_DIRTRIM=6
~/seven/six/five/four/three/two/one$

Without the prompts:

mkdir -p /tmp/seven/six/five/four/three/two/one
cd /tmp/seven/six/five/four/three/two/one
PS1=\w$ 
PROMPT_DIRTRIM=0
PROMPT_DIRTRIM=1
PROMPT_DIRTRIM=2
PROMPT_DIRTRIM=3
PROMPT_DIRTRIM=4
PROMPT_DIRTRIM=5
PROMPT_DIRTRIM=6
PROMPT_DIRTRIM=7
PROMPT_DIRTRIM=8
cd ~
mkdir -p ~/seven/six/five/four/three/two/one
cd ~/seven/six/five/four/three/two/one
PROMPT_DIRTRIM=0
PROMPT_DIRTRIM=1
PROMPT_DIRTRIM=2
PROMPT_DIRTRIM=3
PROMPT_DIRTRIM=4
PROMPT_DIRTRIM=5
PROMPT_DIRTRIM=6


Re: Use of pipe in $( filename | program) returns null

2009-11-28 Thread pk
Chet Ramey wrote:

 r...@saturn.syslang.net wrote:
 
 Description:
 use of $( filename | program) does not work. It either should or it
 should be properly documented. The problem also happens on bash4.
 
 Repeat-By:
 
 qq=$( /etc/passwd | grep sys)
 echo $qq
 # result is null
 
 Fix:
 Either fix the docs to tell people that a pipe is not allowed or fix the
 code to allow it.
 
 That construct is very limited.  As the bash man page says:
 
 The command substitution $(cat file) can be replaced by the equivalent
 but faster $( file).
 
 That seems pretty clear.

Yeah, and then based on that he probably thought that

$(cat file | grep sys)

could be replaced by

$( file | grep sys)

which is not the case.


Re: PROMPT_DIRTRIM skips depth n-1 when ~ is n

2009-11-28 Thread Chet Ramey
DennisW wrote:
 On Nov 28, 5:25 am, dennis den...@netstrata.com wrote:
 Configuration Information [Automatically generated, do not change]:Machine:
 i486OS: linux-gnuCompiler: gccCompilation CFLAGS:  -DPROGRAM='bash'
 -DCONF_HOSTTYPE='i486' -DCONF_OSTYPE='lin$uname output: Linux emperor
 2.6.31-14-generic #48-Ubuntu SMP Fri Oct 16 14:04:2$Machine Type:
 i486-pc-linux-gnu
 Bash Version: 4.0Patch Level: 33Release Status: release
 Description:
 If you are in a directory below ~ and you set PROMPT_DIRTRIM to the
 depthminus 2 it includes the depth minus 1 directory in the prompt as
 well.
 Repeat-By:
 $ mkdir -p /tmp/seven/six/five/four/three/two/one$ cd
 /tmp/seven/six/five/four/three/two/one$ PS1=\w$
 /tmp/seven/six/five/four/three/two/one$
 PROMPT_DIRTRIM=0/tmp/seven/six/five/four/three/two/one$
 PROMPT_DIRTRIM=1.../one$ PROMPT_DIRTRIM=2.../two/one$
 PROMPT_DIRTRIM=3.../three/two/one$ PROMPT_DIRTRIM=4.../four/three/two/one$
 PROMPT_DIRTRIM=5.../five/four/three/two/one$
 PROMPT_DIRTRIM=6.../six/five/four/three/two/one$
 PROMPT_DIRTRIM=7.../seven/six/five/four/three/two/one$
 PROMPT_DIRTRIM=8/tmp/seven/six/five/four/three/two/one$ cd ~~$ mkdir -p
 ~/seven/six/five/four/three/two/one~$ cd
 ~/seven/six/five/four/three/two/one~/seven/six/five/four/three/two/one$
 PROMPT_DIRTRIM=0~/seven/six/five/four/three/two/one$
 PROMPT_DIRTRIM=1~/.../one$ PROMPT_DIRTRIM=2~/.../two/one$
 PROMPT_DIRTRIM=3~/.../three/two/one$
 PROMPT_DIRTRIM=4~/.../four/three/two/one$
 PROMPT_DIRTRIM=5~/.../five/four/three/two/one$
 PROMPT_DIRTRIM=6~/seven/six/five/four/three/two/one$

 Repeated here without the prompts:
 mkdir -p /tmp/seven/six/five/four/three/two/onecd
 /tmp/seven/six/five/four/three/two/onePS1=\w$
 PROMPT_DIRTRIM=0PROMPT_DIRTRIM=1PROMPT_DIRTRIM=2PROMPT_DIRTRIM=3PROMPT_DIR T
 RIM=4PROMPT_DIRTRIM=5PROMPT_DIRTRIM=6PROMPT_DIRTRIM=7PROMPT_DIRTRIM=8cd
 ~mkdir -p ~/seven/six/five/four/three/two/onecd
 ~/seven/six/five/four/three/two/onePROMPT_DIRTRIM=0PROMPT_DIRTRIM=1PROMPT_D I
 RTRIM=2PROMPT_DIRTRIM=3PROMPT_DIRTRIM=4PROMPT_DIRTRIM=5PROMPT_DIRTRIM=6
 
 Once again, something - probably Linux vs. Windows line endings -
 screwed up my post. Here it is straightened out. Hopefully.
 
 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 emperor 2.6.31-14-generic #48-Ubuntu SMP Fri Oct
 16 14:04:26 UTC 2009 i686 GNU/Linux
 Machine Type: i486-pc-linux-gnu
 
 Bash Version: 4.0
 Patch Level: 33
 Release Status: release
 
 Description:
 
 If you are in a directory below ~ and you set PROMPT_DIRTRIM to the
 depth
 minus 2 it includes the depth minus 1 directory in the prompt as well.

Thanks for the report.  This will be fixed in bash-4.1.

Chet

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRUc...@case.eduhttp://cnswww.cns.cwru.edu/~chet/