LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   aliases with bash shell (https://www.linuxquestions.org/questions/linux-newbie-8/aliases-with-bash-shell-597059/)

edccmu22 11-04-2007 10:39 AM

aliases with bash shell
 
On my old linux box (FC4), I had the following line in my .cshrc file:

alias emacs 'emacs \!* &'

On my new computer (Ubuntu 7.10), I'd like to have the same alias. I noticed that there was a .bashrc file, so I tried to put the same line in it. After changing the syntax to:

alias emacs='emacs \!* &'

it sources, but I get the following error if I try to open a file:

$ emacs file.txt
[1] 7296
bash: file.txt: command not found

which then opens up emacs but not file.txt.

Since I'm not the one who wrote the original line, I'm not sure what I need to change or where to even look for info about linux wildcard characters.

Thanks in advance for the help.

- Ed

Tinkster 11-04-2007 11:10 AM

Hi,

And welcome to LQ!

Code:

man bash
/^ALIASES

Paragraph 3 of that section says:
Quote:

There is no mechanism for using arguments in the replacement text. If
arguments are needed, a shell function should be used (see FUNCTIONS
below).


Cheers,
Tink

edccmu22 11-04-2007 11:46 AM

Thank you! For anyone interested, here's the equivalent:

emacs () { emacs "$@" & }

Tinkster 11-04-2007 11:59 AM

Well done :}

Nice to see people who can actually read man-pages.



Cheers,
Tink


All times are GMT -5. The time now is 07:17 AM.