aliases, arguments and & in bash

aliases, arguments and & in bash

Post by Benjam » Thu, 04 Dec 2003 04:41:44



Hi CUS,

I'm new to the bash shell having used tcsh for many years.   I'm
trying to convert my tcsh aliases to bash aliases and have ran into a
small but probably simple problem.  I've piddled around for awhile and
have had no luck.

I like to run emacs in multiple separate windows.  In tcsh I had an
alias that is:

alias em 'emacs -name \!* \!* &'

This would allow me to type 'em filename'  to create a new emacs
window with the name of the file as the title of the window.   How
would I do something similar in bash?  The key points i'm looking for
are: a) syntax, b) argument substitution, and c) backgrounding (using
&).

An alternative solution would be to help me fix a tcsh problem.
I would use tcsh on this new machine, but for some reason the history
feature doesn't work?  I changed my shell from default bash to tcsh
using chsh -s /bin/tcsh, it works fine other than there's no command
history.  I have

set history=500
set savehist=$history

commands in my .tcshrc, but no .history file is created ever.  

Versions:
Linux: 2.4.18-27.7.xsmp
chsh: util-linux-2.11n
tcsh: 6.10.00 (Astron) 2000-11-19 (i386-intel-linux) options
8b,nls,dl,al,kan,rh,color,dspm
bash: 2.05a.0(1)-release

Regards,

-Ben
p.s. please reply to email and group.

 
 
 

aliases, arguments and & in bash

Post by those who know me have no need of my nam » Thu, 04 Dec 2003 06:03:25


in comp.unix.shell i read:

Quote:>I like to run emacs in multiple separate windows.  In tcsh I had an
>alias that is:

>alias em 'emacs -name \!* \!* &'

in bourne-derived shells you write a function:


--
a signature

 
 
 

aliases, arguments and & in bash

Post by Walt » Sat, 06 Dec 2003 04:45:55



> in comp.unix.shell i read:

> >I like to run emacs in multiple separate windows.  In tcsh I had an
> >alias that is:

> >alias em 'emacs -name \!* \!* &'

> in bourne-derived shells you write a function:



**
A function will work, yet the following aliases also
work in bash.  I started using the aa alias for alias
on the Amiga many years ago.

  alias  aa='alias'
  alias lsl='/bin/ls -l --color=never'

Walt R.

 
 
 

aliases, arguments and & in bash

Post by Kevin Rodger » Sat, 06 Dec 2003 04:59:16




>>in comp.unix.shell i read:

>>>I like to run emacs in multiple separate windows.  In tcsh I had an
>>>alias that is:

>>>alias em 'emacs -name \!* \!* &'

>>in bourne-derived shells you write a function:


> **
> A function will work, yet the following aliases also
> work in bash.  I started using the aa alias for alias
> on the Amiga many years ago.

>   alias  aa='alias'
>   alias lsl='/bin/ls -l --color=never'

An alias is simply substituted when it occurs as a command name, so
it won't work if the command arguments have to be repeated (as the
OP requires) or if they occur anywhere but in sequence at the very
end of the substituted command.

--
Kevin Rodgers

 
 
 

1. BASH BASH BASH BASH BASH BASH BASH BASH BASH BASH

Is there a proper fixed bash on any of the FTP sites out there?

I know there bash is on the usual sites but I don't know if they are
bugged or not :(

Regards,

Neil.

--


------------------------------------| Edinburgh, EH14 2DE, United Kingdom
**Domino: There`s nothing you can do when you`re the next in line: Domino**

2. sendmail: error on output channel

3. BASH: alias and arguments?

4. socket prog: server doesn't recognize disconnect

5. bash: using alias & functions none-interactively

6. problems with gnome (gmc, panel...) under RedHat 5.2

7. How to use bash alias including '&' ?

8. test

9. MMDF & alias tables (mailing list) alias.list FORMAT

10. Matrox Mystique ands X.

11. passing arguments to an alias

12. alias and command arguments

13. How can I pass arguments to an alias in ksh?