aliases or functions--which to use?
I've been using aliases to access other partitions on my two hard
drives, ranging from
hda1 to hdb9 and don't have any problem that I can detect. I have other
Linux's scattered
throughout the two hard drives. Windows 98 is on hda1, as usual.
Debian's / is on hdb5
For example, In Debian, I can type the command ' win+ ' and see all the
contents of
Windows 98 which is on hda1. I can then manipulate files in Windows ,
such as copy or
move or even edit a Windows file from Debian.
I sometimes download a linux package while operating Windows and then,
later while
operating Debian, move that package to Debian or any other Linux system
Or, conversely,
I can download a Windows file while operating Debian and then move it to
the Windows
partition. I can also move or copy or edit between two Linux's.
All this can be done with simple aliases.
Example:
you should first make a directory da1 in /mnt:
# cd /mnt
# mkdir da1
------then------------
# alias win+='mount -t vfat /dev/hda1 /mnt/da1; cd /mnt/da1; ls -aF
--color'
------and------------
# alias win-='cd; umount /mnt/da1'
Now, by typing win+, you have access to all the files in Windows and you
can edit them from Debian. (No, you can't execute them)
After you've finished, type win- to unmount and restore to Debian.
You can use variations of these commands to work between two different
Linux's.
Notice the example alias is just ordinary commands joined by ; to make
a single command.
I have many such aliases stored in /root/.bashrc so I can call up any
operating system.
In spite of the fact that these aliases work, I'm told by experts that I
shouldn't use aliases
but do the same job by using ' functions '. I've tried this and it does
work but I can't see
any difference . I'm still a novice when it comes to Linux so perhaps
I just don't know
any better.
But, can someone explain why 'functions' should be used instead of
'aliases' ?
Reply to: