On Fri, Feb 26, 2010 at 09:56:05AM +1000, Allan McRae wrote:
On 26/02/10 08:57, Cedric Staniewski wrote:
On 25.02.2010 23:44, Allan McRae wrote:
On 26/02/10 08:23, Cedric Staniewski wrote:
The location of the used utilities may and does differ between various distributions and therefore absolute paths do not work well. Since the main purpose of its introduction was to avoid side-effects caused by aliases, it is sufficient to disable possible aliases temporarily by preceding the commands with a backslash.
That seems fine to me. Just one check. How long has that syntax been available (i.e. is it a bash4ism)?
Allan
Just tested it on GNU bash, version 3.2.39(1)-release and it works. So I guess it's safe to use.
Well, I am happy using this then. The lack of documentation for this feature may be a slight concern, but given it has been supported by bash for a long time, I think we can rely on it.
I've seen this documented before. I don't remember where, but before bash 4. I just checked the Advanced Bash Scripting guide, and the Bash Reference Manual, and didn't find it there. I see in the bash manpage this:
ALIASES Aliases allow a string to be substituted for a word when it is used as the first word of a simple command. The shell maintains a list of aliases that may be set and unset with the alias and unalias builtin commands (see SHELL BUILTIN COMMANDS below). The first word of each simple command, if unquoted, is checked to see if it has an alias. If so, that word is replaced by the text of the alias.
which arguably says that alias expansion won't occur on \echo or "echo". However, I did encounter a more explicit explanation of this somewhere or other... Sorry I hadn't been following the discussion that led up to this. -- Jim Pryor profjim@jimpryor.net