[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: shell wrappers for trig and other mathematical functions



On Wed 02 Oct 2019 at 12:39:27 (-0400), Lee wrote:
> On 10/2/19, Greg Wooledge <wooledg@eeg.ccf.org> wrote:
> 
>   <.. snip ..>
> > Oh, you just want to MINIMIZE TYPING.  Then write a series of shell
> > functions.
> >
> > wooledg:~$ sin() { perl -e 'print sin $ARGV[0], "\n"' "$1"; }
> > wooledg:~$ sin 1
> > 0.841470984807897
> >
> > 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:
> $ alias
> alias cp='cp -i'
[…]
> alias rm='rm -i'

Ouch, a couple of great recipes for losing information.
Far better to train your fingers to spell cp and rm with five characters.

Cheers,
David.


Reply to: