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

Re: shell wrappers for trig and other mathematical functions

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 egrep='egrep --color=auto'
alias fgrep='fgrep --color=auto'
alias grep='grep --color=auto'
alias ls='ls --color=auto'
alias md5='/usr/bin/openssl dgst -md5 '
alias mv='mv -i'
alias name2oid='snmptranslate -IR -On '
alias oid2name='snmptranslate '
alias rm='rm -i'
alias sha1='/usr/bin/openssl dgst -sha1 '
alias sha256='/usr/bin/openssl dgst -sha256 '
alias sha512='/usr/bin/openssl dgst -sha512 '

what am I missing?


Reply to: