Antoni V. dixit:

>I can think of 2 ways.
>
>1- add it to .mkshrc as \alias using=
>2- create /usr/bin/using (chmod +x) and add the one liner to it
3. add it to .mkshrc as function using { … ;}

I usually prefer the function way, except for really small stuff
of stuff that is required to be implemented as alias.

Aliases are handled at parse time and influence current shell
state, they also don't take parameters, they just type as if
you had typed it yourself in that place. That can be useful…

alias sfoo='uxterm -class UXTerm -title uxTerm -u8 -geom 90x35+1+10 -e screen 
-U -R foo & exit'

… but usually isn’t:

sprunge() {
        curl -F 'sprunge=<-' http://sprunge.us
}
# DuckDuckGo search
ddg() {
        local _q _IFS

        _IFS=$IFS
        IFS=+
        _q="$*"
        IFS=$_IFS
        ${BROWSER:-lynx} 
"https://duckduckgo.com/?kp=-1&kl=wt-wt&kb=t&kh=1&kj=g2&km=l&ka=monospace&ku=1&ko=s&k1=-1&kv=1&t=debian&q=$_q";
}


Way #2 (please use /usr/local/bin/ or ~/.etc/bin/ or so) has
its uses as well: aliases and functions are not available in
Midnight Commander’s shell, or from an editor (think pipe a
selection through an external command, ^K/ in jupp). On the
other hand, each call then has fork&exec and disc I/O penalty.

In the end, they’re all *mostly* equivalent.

bye,
//mirabilos
-- 
> Hi, does anyone sell openbsd stickers by themselves and not packaged
> with other products?
No, the only way I've seen them sold is for $40 with a free OpenBSD CD.
        -- Haroon Khalid and Steve Shockley in gmane.os.openbsd.misc

Reply via email to