Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

In my bash terminal I have emacs set to run in XWindows. I prefer this to not freeze my terminal session so I run:

emacs filename &

Is there anyway to alias this? I have tried:

xemacs='emacs $1 &'

with no luck.

share|improve this question

You can create a script to do that for you:

#!/bin/sh
emacs "$@" &
share|improve this answer
    
to protect arguments that have whitespace, use "$@" instead of $* – glenn jackman Jun 27 '11 at 21:43
    
Thanks, I knew that, but forgot... updated my answer. – Flimzy Jun 27 '11 at 21:47

Assuming you're using bash...you can create a shell function by adding this to your .bashrc:

emacs () {
  /usr/bin/emacs "$@" &
}

It accomplishes the same thing as a wrapper, but without the extra wrapper.

share|improve this answer
    
That is an extra wrapper. The only practical difference is that once it's defined, it's stored in memory, rather than on the file system. – Flimzy Jun 28 '11 at 19:07
    
Yes, that is a more precise way to put it. I personally find it distasteful to have several one line shell scripts. With modern systems with plenty of RAM and disk space it is purely an aesthetic decision. – bahamat Jul 5 '11 at 6:33

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .