From 2f43584727075708dc842975f5058947b57ba0c4 Mon Sep 17 00:00:00 2001 From: Jan Kanis Date: Tue, 19 Feb 2013 22:58:55 +0100 Subject: [PATCH] small tweak to alias.fish: always add some prefix if in danger of infinite recursion --- share/functions/alias.fish | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/share/functions/alias.fish b/share/functions/alias.fish index b6597ee26..236654ecd 100644 --- a/share/functions/alias.fish +++ b/share/functions/alias.fish @@ -36,15 +36,14 @@ function alias --description "Legacy function for creating shellscript functions end - # If we are shadowing an existing (internal or external) command, set the - # correct prefix. If $name is different from the command in $body, we assume - # the user knows what he/she is doing. + # Prevent the alias from immediately running into an infinite recursion if + # $body starts with the same command as $name. switch $body case $name $name\ \* $name\t\* if contains $name (builtin --names) set prefix builtin - else if which $name >/dev/null + else set prefix command end end