Tell me more ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I use MacBook Air with OSX 10.7.2.

I would like to create an alias that does the following:

  • Opens TextMate with ~/.bashrc and allows me to edit it
  • Once I close TextMate, "sources" ~/.bashrc (so if I add a new alias, for example, it will be available immediately)

I tried the following:

alias b="/usr/bin/mate -w ~/.bashrc; source ~/.bashrc"

but it doesn't work: when I close TextMate, the shell doesn't return (I don't see the shell prompt).

Any ideas?

share|improve this question
Works for me. Is your bashrc syntax okay? – slhck Nov 22 '11 at 22:15
Yes, for sure.. – Misha Moroshko Nov 22 '11 at 22:55
Well, I tested on 10.6 with TextMate 1.5.10 (latest, afaik). Maybe you found a bug? Am I reading this right, your shell just does not work anymore? – slhck Nov 22 '11 at 22:58
Once you solve the non-returning shell issue, you may want to put an unalias -a command before the source command in the definition so any deletions you make in the editor will be reflected in the current shell's new alias set. F/ex, if you found you'd accidentally made a dangerous alias and you use your b alias to edit it out, the present definition would leave the bad alias in the current shell, waiting to bite you. – JRobert Nov 23 '11 at 1:11

1 Answer

I don't have TextMate, but using your example with emacs works as expected. Possibly a problem with TextMate? Could you try another editor?

share|improve this answer
It definitely works with TextMate, I just tried it exactly as written in the question. I presume it's a syntax error in bashrc. – slhck Nov 22 '11 at 22:19
There is no error in ~/.bashrc. I deleted it completely, and put only the one line above. I tried to do the same with emacs: /usr/bin/emacs ~/.bashrc; source ~/.bashrc (no -w here), and it works as expected. – Misha Moroshko Nov 22 '11 at 22:54

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.