So I've fallen into this classic trap. While trying to teach myself some basic bash scripting, I decided that I wanted to do this:
alias emacs=emacsFunction
emacsFunction() {
if [ "$#" -eq 1 ]; then
emacs $1 &
fi
emacs
}
The goal is pretty simple. When I type emacs into the Terminal, if I supply an argument (e.g. emacs .bashrc), I want it to open my .bashrc file in emacs and still allow me to input commands in my terminal window (adding '&' to a command allows this).
I'm open to any and all suggestions. I'm sure that there is a way more efficient (smarter) way to do this than the code I have here.
Thanks in advance!