[comp.unix.shell] Append command-line filespec to path in alias?

jaw@cs.arizona.edu (Jim Wilson) (04/22/91)

How can I write a csh alias that will pre-pend a path to a command-line
file name?

Example:
    alias oldnews 'elm -f ~/.News/<here is where I'm lost>'

Then,

     oldnews comp.unix.shell

should result in

     elm -f ~/.News/comp.unix.shell

Thanks for whatever you can offer.

mjo@irie.ais.org (Mike O'Connor) (04/22/91)

In article <1436@caslon.cs.arizona.edu> jaw@cs.arizona.edu (Jim Wilson) writes:
:How can I write a csh alias that will pre-pend a path to a command-line
:file name?
:
:Example:
:    alias oldnews 'elm -f ~/.News/<here is where I'm lost>'

The missing magic is:

alias oldnews 'elm -f ~/.News/\!^'




====
Mike O'Connor (mjo@ais.org)

jik@athena.mit.edu (Jonathan I. Kamens) (04/22/91)

In article <1436@caslon.cs.arizona.edu> jaw@cs.arizona.edu (Jim Wilson) writes:

       alias oldnews 'elm -f ~/.News/<here is where I'm lost>'
   Then,
	oldnews comp.unix.shell
   should result in
	elm -f ~/.News/comp.unix.shell

alias oldnews 'elm -f ~/.News/\!:1'

You could also use '\!*' or '\!:*' if you always only run the alias
with one argument.

This should be documented in the man page for csh(1) on your system,
in the section entitled "Alias substitution."  At least, that's where
it is on my system.

Jonathan Kamens			              USnail:
MIT Project Athena				11 Ashford Terrace
jik@Athena.MIT.EDU				Allston, MA  02134
Office: 617-253-8085			      Home: 617-782-0710