Programming and Scripting :: Aliases



If you put all aliases in one file, eg .alias, then you can start your favourite apps from a bash script, lke this:
Code Sample

#!/bin/bash
#make sure you start this from aterm, not the root console

source $HOME/.alias
path/to/graphical-application &

Guys guys.

Maybe you understand my problem if I show part of my .bashrc file for you:
Code Sample
   alias ll="ls -lhaFC"
   alias reboot="sudo shutdown -r +5 "
   alias fastreboot="sudo shutdown -r now Brb. Sorry."


No. I do NOT use these aliases in scripts. I just want to add some aliases to make few things faster.

I wonder what I did wrong...
One thing more: dir alias seems to work. O.o If that works, why doesn't my aliases as they are definied just after dir alias?

If you make changes to .bash_profile, they will not be applied until you either log out and back in again, or exit X and source /home/dsl/.bash_profile.

The .bash_profile file is run only for login shells, which in DSL means that it is run only once, when you first log in.  For this reason I recommend adding aliases to .bashrc instead, and source that file from .bash_profile.  In this way, every shell will have access to the aliases, and changes will not require re-sourcing for anything but the currently opened shell(s).

The suggestion made by the professor will work as well, though you will need to source the file from .bashrc AND source either .alias or .bashrc from .bash_profile in order to apply aliases to all shells. It is, however, a very useful method of setting alias groups, to have different sets of aliases at different times.

Yes. I got that too while reading some manuls... But the solution to this problem...
I'll try that soucing method...

Thanks guys. :D
source command worked just fine...

Is the source command just like 'include' in PHP?

Next Page...
original here.