Re: How to change the command completion behavior in bash

2009-11-16 Thread Henning Garus
On Sun, Nov 15, 2009 at 08:31:38PM -0600, Peng Yu wrote:
> If I have the following in the command line,
> 
> ~/.bash
> 
> when I type , it will become /home/my_user_name/.bash
> 
> I'm wondering if it is possible to configure bash command completion,
> so that it will still be '~/.bash'
> 

Add

set expand-tilde off

to your ~/.inputrc . However off is the default value, so you could
try to find out where it is set to on and remove that.

See "Readline Variables" in man bash.




Re: How to change the command completion behavior in bash

2009-11-16 Thread Chet Ramey
> If I have the following in the command line,
> 
> ~/.bash
> 
> when I type , it will become /home/my_user_name/.bash
> 
> I'm wondering if it is possible to configure bash command completion,
> so that it will still be '~/.bash'

You don't say what version of bash you're using, but bash-3.2 and bash-4.0
both preserve the tilde by default.

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/




[[ and set -E vs trap ERR

2009-11-16 Thread Isaac Good
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. -I./include -I./lib   -march=i686 
-mtune=generic -O2 -pipe
uname output: Linux arch 2.6.31-ARCH #1 SMP PREEMPT Fri Oct 23 11:12:58 CEST 
2009 i686 Pentium III (Katmai) GenuineIntel GNU/Linux
Machine Type: i686-pc-linux-gnu

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

cat <<-EOF >test
#!/bin/bash -e
set -E
trap 'echo >&2 "error"' ERR

echo TEST1
if [ $(false) ] ; then
echo 1
fi

echo TEST2
if [[ $(false) ]] ; then
echo 1
fi
EOF

Expected output:
TEST1
TEST2

Actual output:
TEST1
TEST2
error

The [[ masks the fact that an 'if' is running - but only in regards to the 
trap. bash does not exit on this error but the trap is triggered. 
[ works fine.
With set -E, the trap is inherited by command substitution, but the fact that 
the trap is suppressed is not.

<\amethyst> but the manpage says the ERR trap is avoided under "the same 
conditions obeyed by the errexit option", so at least the documentation is in 
error if nothing else