25 Mart 2021 Perşembe tarihinde Chris F.A. Johnson <ch...@cfajohnson.com> yazdı:
> On Thu, 25 Mar 2021, Oğuz wrote: > > 24 Mart 2021 Çarşamba tarihinde Robert Elz <k...@munnari.oz.au> yazdı: >> >> Date: Wed, 24 Mar 2021 11:15:11 +0300 >>> From: =?UTF-8?B?T8SfdXo=?= <oguzismailuy...@gmail.com> >>> Message-ID: <CAH7i3Lqg_H=nTJn3FiZ9PQ9eKWcx >>> k0pzmyz8_pnpljtk4es...@mail.gmail.com> >>> >>> | I think I got the general idea of aliases now >>> >>> I'm not sure why you want or need that, aliases >>> are dumb (bizarre) and shoukd be deleted... >>> >>> I keep trying to get tge POSIX people to >>> remove them from the standard. They keep ignoring me. Shells won't drop >>> support, but at least >>> no-one woukd be able to rely on them working, >>> or working any particular way any more. >>> >> >> >> They are fine as an interactive feature but definitely don't belong in >> shell scripts. >> > > The only place I've ever used aliases is in a script: > > alias show_command='[ $verbose -gt ${debuglevel:-0} ] && printf "%s" "++ > $FUNCNAME " "${@/%/ }" && echo ' > > I couldn't use a function (which I do for all interactive uses) because > that would change $FUNCNAME. FUNCNAME is an array. Inside a function `${FUNCNAME[1]}' expands to its caller's name. If you declared `show_command' as a function, you'd have to call it like `show_command "$@"' though, there is no other way for a function to access its caller's positional parameters as far as I'm concerned. > > > -- > Chris F.A. Johnson <http://cfajohnson.com/> > =========================== Author: =============================== > Shell Scripting Recipes: A Problem-Solution Approach (2005, Apress) > Pro Bash Programming: Scripting the GNU/Linux shell (2009, Apress) > -- Oğuz