Re: shell wrappers for trig and other mathematical functions
On Thu, 3 Oct 2019 at 02:39, Lee <ler762@gmail.com> wrote:
> On 10/2/19, Greg Wooledge <wooledg@eeg.ccf.org> wrote:
>> This is what shell functions are for. You can just drop the shell
>> functions into your ~/.bashrc and then use them in every interactive
>> shell thenceforth.
>> I strongly recommend this approach over the aliases that were previously
>> suggested, by the way. Functions are so much cleaner.
> How are functions cleaner?
> I've been using aliases for I don't know how long and haven't noticed
> any problems:
> what am I missing?
Seeing as this is a FAQ, I hope it's not impolite for me to
respectfully chip-in with some links in reply:
https://mywiki.wooledge.org/BashGuide/CommandsAndArguments#Aliases
https://mywiki.wooledge.org/BashGuide/CommandsAndArguments#Functions
http://mywiki.wooledge.org/BashFAQ/080
https://mywiki.wooledge.org/BashGuide/CompoundCommands#Functions
I understand "cleaner" to mean that functions take arguments, so they
work in a way that is more intuitive and robust.
One mechanism (alias) is a leading-text substitution, the other (function)
is a programming language.
Use what meets your needs, with aware of limitations and alternatives.
aliases have an easy user interface.
'man bash' says:
For almost every purpose, aliases are superseded by shell functions.
I hope this is a useful response, apologies if you knew all this already.
Reply to: