Re: alias expansion with functions in non-interactive mode
From:
Andreas Schwab
Subject:
Re: alias expansion with functions in non-interactive mode
Date:
Sat, 31 May 2008 09:28:01 +0200
User-agent:
Gnus/5.110009 (No Gnus v0.9) Emacs/22.2 (gnu/linux)
Marco <marco@tampabay.rr.com> writes:
> : cat test.sh
> #!/bin/bash
> function foo
> {
> shopt -s expand_aliases
> alias ls='ls -l'
> ls /
> }
>From the manual:
Aliases are expanded when a function definition is read, not when the
function is executed, because a function definition is itself a
compound command.
Andreas.
--
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."