[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Bash sometimes cannot find aliases
From: |
DennisW |
Subject: |
Re: Bash sometimes cannot find aliases |
Date: |
Thu, 28 Jan 2010 15:24:12 -0800 (PST) |
User-agent: |
G2/1.0 |
On Jan 28, 2:55 am, Dan Zwell <dzw...@zwell.net> wrote:
> 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 -march=x86-64
> -mtune=generic -O2 -pipe
> uname output: Linux mordor 2.6.32-ARCH #1 SMP PREEMPT Mon Jan 18
> 23:30:46 CET 2010 x86_64 Intel(R) Core(TM)2 Duo CPU T7300 @ 2.00GHz
> GenuineIntel GNU/Linux
> Machine Type: x86_64-unknown-linux-gnu
>
> Bash Version: 4.1
> Patch Level: 2
> Release Status: release
>
> Description:
> When I attempt to run an alias, Bash occasionally says the command is
> not found. Re-running the command generally succeeds. This also occurs
> with aliases that are named after existing programs. For example,
> running "ls", which is aliased to "ls --color", occasionally results in
> "ls" being run without the "--color" argument (the alias is bypassed).
>
> Repeat-By:
> This problem seems to occur once every few hundred aliased commands I
> run. It seems more frequent immediately after sourcing a .bashrc file. I
> cannot reproduce it with a loop that repeatedly runs an aliased command.
>
> Is this a known issue? I may be able to help debug this (perhaps by
> modifying my build to log state when a command is not found).
>
> Thanks
> -Dan
I can think of two ways to bypass an alias that will produce the
behavior you describe. These are by design. Perhaps the issue you are
experiencing is related or perhaps not.
/tmp$ alias
alias ls='ls --color=always'
/tmp$ ls
<colorful output>
/tmp$ \ls
<monochrome output>
/tmp$ command ls
<monochrome output>
/tmp$ alias p=pwd
/tmp$ p
/tmp
/tmp$ \p
p: command not found
/tmp$ command p
p: command not found
/tmp$ echo \\ > backslash
/tmp$ . ./backslash
/tmp$ p
p: command not found
/tmp$ p
/tmp
So perhaps the file you are sourcing has a stray backslash at the end.