LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 11-04-2007, 10:39 AM   #1
edccmu22
LQ Newbie
 
Registered: Feb 2006
Posts: 2

Rep: Reputation: 0
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
 
Old 11-04-2007, 11:10 AM   #2
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 22,973
Blog Entries: 11

Rep: Reputation: 879Reputation: 879Reputation: 879Reputation: 879Reputation: 879Reputation: 879Reputation: 879
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
 
Old 11-04-2007, 11:46 AM   #3
edccmu22
LQ Newbie
 
Registered: Feb 2006
Posts: 2

Original Poster
Rep: Reputation: 0
Thank you! For anyone interested, here's the equivalent:

emacs () { emacs "$@" & }
 
Old 11-04-2007, 11:59 AM   #4
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 22,973
Blog Entries: 11

Rep: Reputation: 879Reputation: 879Reputation: 879Reputation: 879Reputation: 879Reputation: 879Reputation: 879
Well done :}

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



Cheers,
Tink
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Useful shell aliases exit3219 Linux - General 14 03-16-2007 04:18 AM
Bash aliases in OS X?? Grife Other *NIX 3 03-14-2007 06:26 AM
Using shell aliases in make Dark_Helmet Programming 13 02-26-2007 03:16 AM
aliases and the 'sh' shell koodoo Linux - Newbie 14 08-05-2006 04:19 AM
Bash aliases won't autostart? Ollir Mandriva 7 08-22-2004 02:10 PM


All times are GMT -5. The time now is 09:12 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration