|
From: | ken |
Subject: | Re: how to use bash alias in emacs compile |
Date: | Mon, 07 May 2012 16:04:01 -0400 |
User-agent: | Mozilla/5.0 (X11; Linux i686; rv:10.0.4) Gecko/20120424 Thunderbird/10.0.4 |
On 05/07/2012 03:48 PM Daniel (Youngwhan) wrote:
On May 3, 1:35 am, "Pascal J. Bourguignon"<p...@informatimago.com> wrote:"Daniel (Youngwhan)"<breadn...@gmail.com> writes:Hi,I have alias like this:alias dm='cd ~/XYZ&& ./mycompile.sh'Where do you have it?The lots of aliases are defined in a file, where is in $HOME/bin, and the $PATH has it, too.I typed M-x compile, and tried to run by just typing "dm", but it doesn't recognize.Try: M-x compile RET C-a C-k bash -i -c dm RETYeah, it works!, but if I typed only dm, it doesn't.I searched and some suggest BASH_ENV, so I tried, but not working.man bash explains in details what file it will load and when, but it's complicated. I put everything in ~/.bashrcLet me study you've mentioned here, but if you can share your experience in detail, it would be appreciated.
Yes, ~/.bashrc is the place to put aliases... because then they are loaded whenever you log in. If this isn't the behavior you want, then you can put them somewhere else, e.g., in ~/bin/aliases, but then you'll have to invoke them yourself. This can be done with either of these commands:
source ~/bin/aliases or . ~/bin/aliases(Note that "~/bin/aliases" is an example name I made up. Just about any normal filename can be given.)
If you edit ~/.bashrc, including new aliases in it, you can use the same commands as above to read those new aliases into the current environment with:
source ~/.bashrc or . ~/.bashrcThen you don't have to log out and then log back in to put your new aliases into effect.
hth
[Prev in Thread] | Current Thread | [Next in Thread] |