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

Re: Alternative to aliases??



On Thu, Aug 02, 2001 at 12:35:43PM -0400, alex wrote:
| 
| Someone claimed on a list that there's an alternative to aliases that
| does things better.  I use aliases to access any partition for editing
| and they run just fine but I'm wondering what other way could this be
| done?
| 
| What can be simpler than typing  da1+  to get at the contents of the
| Windows partition, or typing  CD+  to get at the contents of a CD or L+
| or W+ to get to a Linux or Windows floppy? 

Could you include the definitions of those aliases?  When I want to
"access" the contents of a CD I simply type 'ls /cdrom'.

| Does anyone know of a routine that is superior to aliases to accomplish
| what aliases can do?  I recall that the procedure was described but
| because of its complexity, I passed on it.

Functions can be defined in your .bashrc (or any script really) or you
could use separate scripts.  The main thing to be careful of is
infinite recursion.  For example, the following is bad

    function ls()
    {
        ls --color=auto -p $*
    }

however the folowing will work

    function ls()
    {
        /bin/ls --color=auto -p $*
    }

(umm, I'm assuming here that ls is in /bin because I don't have my
machine to check righ tnow)


-D



Reply to: