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, 11: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, 12:10 PM   #2
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
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, 12:46 PM   #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, 12:59 PM   #4
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
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 05:18 AM
Bash aliases in OS X?? Grife Other *NIX 3 03-14-2007 07:26 AM
Using shell aliases in make Dark_Helmet Programming 13 02-26-2007 04:16 AM
aliases and the 'sh' shell koodoo Linux - Newbie 14 08-05-2006 05:19 AM
Bash aliases won't autostart? Ollir Mandriva 7 08-22-2004 03:10 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 08:36 PM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration