[EMAIL PROTECTED] wrote:
>
> Thanks Matthew. Just one other question though. Can I string multiple
> commands together inside one alias?
>
> John
Sure, here's what I do on a different system:
--------------------------------------------------------------------------
cddev() { cd /home/matthew/Uber/Dev; pwd ;}
mcd1() { mount -F cdfs -r /dev/cdrom/cdrom1 /mnt && echo "Cd mounted.\n" ;}
uboot() { umount /mnt ;}
fwho() { cls; ftpwho ;}
xpcp() { cd /usr/lib/powerchute; /usr/lib/powerchute/xpowerchute ;}
--------------------------------------------------------------------------
Now the last command is useful because the program
xpowerchute require the user be in the directory for
it to execute properly. But the downside of that
shell function is that, once you exit xpowerchute,
you'll be left in /usr/lib/powerchute, not where
you originally called xpcp from. That can be frustrating
to have your aliases bounce you around the filesystems.
So in case you want to return to the original directory
you called xpcp from, you could write the shell function
like this:
xpcp() { ( cd /usr/lib/powerchute; /usr/lib/powerchute/xpowerchute ) ;}
or like this, which is more often seen:
xpcp() {
( cd /usr/lib/powerchute
/usr/lib/powerchute/xpowerchute )
echo "Program completed"
pwd
}
> What directory would the scripts be put into? Is there a DOS
> equivilent of a PATH that is searched?
These aliases and shell functions come from my /etc/profile.
They are written in that file, which gets executed for every
user, when the user logs in.
If you want the aliases and shell functions to be executed
only for user root, then put them into /root/.profile, which
is often written in shorthand notation as ~/.profile, where the
~ means "the user's home directory" or as $HOME/.profile.
Are you with me so far?
These aliases and shell functions that are in one of those
files get executed as I mentioned at login time. Once
those get executed, they are stored in the shells memory
and are accessible no matter what your $PATH is set as.
They become "built-in,"
To list your built in variables, like PATH, use
set
To list your built in aliases, use
alias
To list your built in shell functions your
are supposed to be able to use set, but that
doesn't work on Oxygen, so, if you know the
name of a command that's a shell function and
you want to see how it's defined, you use
type help
and that would look like this:
# type help
help is a function
help() {
more /var/lib/lrpkg/${1}.help
}
It took me a bit to learn all those tricks.
I hope you like them.
Matt
_______________________________________________
Leaf-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/leaf-user