bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Issues when func name is the same with an alias


From: Clark J. Wang
Subject: Issues when func name is the same with an alias
Date: Wed, 4 Aug 2010 18:39:38 +0800

I was testing the precedence between functions and aliases so I tried like
this (with bash 4.1.5):

$ cat rc
alias foo='echo this is the alias'

foo()
{
    builtin echo 'this is the function'
}

foo
$ source rc
bash: confusing-aliases-2.sh: line 4: syntax error near unexpected token `('
bash: confusing-aliases-2.sh: line 4: `foo()'
$

Seems like I must explicitly use the `function' keyword to define foo() for
this scenario. Is that the correct behavior?


reply via email to

[Prev in Thread] Current Thread [Next in Thread]