Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

2 Answers 2

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

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.