Path: csiph.com!goblin1!goblin.stu.neva.ru!usenet.stanford.edu!not-for-mail From: L A Walsh Newsgroups: gnu.bash.bug Subject: Re: alias problem -- conflict found Date: Wed, 10 Jul 2019 09:01:28 -0700 Lines: 30 Approved: bug-bash@gnu.org Message-ID: References: <5D25D398.7010300@tlinx.org> <5D255A6E.4060600@tlinx.org> <5D23C417.5060108@tlinx.org> <20190709132112.GW2450@eeg.ccf.org> <10340.1562742284@jinx.noi.kre.to> <11760.1562772554@jinx.noi.kre.to> <5D260BD8.8010800@tlinx.org> NNTP-Posting-Host: lists.gnu.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Trace: usenet.stanford.edu 1562774534 13027 209.51.188.17 (10 Jul 2019 16:02:14 GMT) X-Complaints-To: action@cs.stanford.edu Cc: bug-bash@gnu.org To: Robert Elz Envelope-to: bug-bash@gnu.org User-Agent: Thunderbird In-Reply-To: <11760.1562772554@jinx.noi.kre.to> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x (no timestamps) [generic] X-Received-From: 173.164.175.65 X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Mailman-Original-Message-ID: <5D260BD8.8010800@tlinx.org> X-Mailman-Original-References: <5D25D398.7010300@tlinx.org> <5D255A6E.4060600@tlinx.org> <5D23C417.5060108@tlinx.org> <20190709132112.GW2450@eeg.ccf.org> <10340.1562742284@jinx.noi.kre.to> <11760.1562772554@jinx.noi.kre.to> Xref: csiph.com gnu.bash.bug:15123 On 2019/07/10 08:29, Robert Elz wrote: > > | Aliases are used internally by bash to store path lookups, by > | default. > > Really? I haven't looked at any bash code in a very long time > (for licensing reasons, I don't want to be corrupted by the GPL) > but that sounds like a very weird way of implementing things if true. > > | They are simply more efficient. If functions were better, bash would > | implement path lookups by defining a function for each > > No it wouldn't, it would (probably actually does, since I can find > nothing that indicates otherwise) keep a hash table with the results > of path lookups. Nothing related to aliases in any way at all. > What do you think aliases are? They are both a simple hash substitution. env -i /bin/bash -c 'shopt -s expand_aliases;ls /tmp >&/dev/null;alias ls=/bin/ls;declare -p BASH_CMDS BASH_ALIASES' declare -A BASH_CMDS=([ls]="/usr/bin/ls" ) declare -A BASH_ALIASES=([ls]="/bin/ls" ) Aliases are store/implemented using hashes the same as stored paths are. They are effectively the same.