It's not necessary to delete a function definition before replacing it, but
there is a point to removing an alias before defining a like-named function.

So the keyword you're looking for is "unalias", not "unset".

If for some reason you absolutely must have an alias and a function with
the same name, consider forcing parsing of the function before the alias
command is executed:

 { alias foo=bar; foo() { echo this is not Bar; }

or use a ksh-style function definition:

 alias foo=bar
 function foo { echo this is not Bar; }

(note the lack of () in the latter form)

-Martin

On Wed, 14 Jan 2026, 06:01 Jason Puschnig, <[email protected]> wrote:

> Version: GNU bash, version 5.3.9(1)-release (x86_64-pc-linux-gnu)
>
> Below is the code needed to reproduce this bug. I have been able to
> reproduce this reliably by starting a new interactive shell and entering
> each line manually.
>
> alias print=printf
>
> unset print
>
> print() {
>
> printf $1
>
> }
>
>
>
>

Reply via email to