|
Home > Archive > Unix administration > March 2004 > UNIX Alias Question: Indefinite number of arguments
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
UNIX Alias Question: Indefinite number of arguments
|
|
| Quito Quito 2004-03-13, 2:33 am |
| Dear All:
I created a Fortran library using all the subroutines from Numerical
Recipes and named it "librecipes_f.a" and put it in the directory
/home/Libraries/. Now when I have a main, say "main.f", that calls
any subroutine included in the library, I simply type the following to
compile
% f77 main.f /home/Libraries/librecipes_f.a
That command is too long to use frequently, so I alias the above using
the following
% alias nr77 'f77 \!:1 /home/Libraries/librecipes_f.a'
With that, I can simply type
% nr77 main.f
to compile my main code.
However, if my main program calls an additional subroutine, say
"sub01.f", of my own, I have to use an alias that allows two (2)
arguments as follows
% alias nr277 'f77 \!:1 \!:2 /home/Libraries/librecipes_f.a'
to issue my command
% nr277 main.f sub01.f
However, since the number of additional subroutines the main program
may call is indefinite, how I can design an alias that allows
insertion of an indefinite number of arguments between 'f77' and
'/home/Libraries/librecipes_f.a' so that I can simply type
% nrn77 main.f sub01.f sub02.f sub03.f ... sub0n.f
that still includes the library?
To put it simply, how do you design an alias that allows an indefinite
number of arguments somewhere in the middle rather than at the end?
Thanks.
| |
| Jim Hollenback 2004-03-13, 2:33 am |
| Quito Quito (qquito@hotmail.com) wrote:
: Dear All:
: I created a Fortran library using all the subroutines from Numerical
: Recipes and named it "librecipes_f.a" and put it in the directory
: /home/Libraries/. Now when I have a main, say "main.f", that calls
: any subroutine included in the library, I simply type the following to
: compile
: % f77 main.f /home/Libraries/librecipes_f.a
: That command is too long to use frequently, so I alias the above using
: the following
: % alias nr77 'f77 \!:1 /home/Libraries/librecipes_f.a'
: With that, I can simply type
: % nr77 main.f
: to compile my main code.
: However, if my main program calls an additional subroutine, say
: "sub01.f", of my own, I have to use an alias that allows two (2)
: arguments as follows
: % alias nr277 'f77 \!:1 \!:2 /home/Libraries/librecipes_f.a'
: to issue my command
: % nr277 main.f sub01.f
: However, since the number of additional subroutines the main program
: may call is indefinite, how I can design an alias that allows
: insertion of an indefinite number of arguments between 'f77' and
: '/home/Libraries/librecipes_f.a' so that I can simply type
: % nrn77 main.f sub01.f sub02.f sub03.f ... sub0n.f
: that still includes the library?
: To put it simply, how do you design an alias that allows an indefinite
: number of arguments somewhere in the middle rather than at the end?
man make will be helpful
--
Jim Hollenback
jholly@cup.hp.com
my opinion.
| |
| phn@icke-reklam.ipsec.nu 2004-03-13, 6:33 am |
| In comp.unix.admin Quito Quito <qquito@hotmail.com> wrote:
> Dear All:
> I created a Fortran library using all the subroutines from Numerical
> Recipes and named it "librecipes_f.a" and put it in the directory
> /home/Libraries/. Now when I have a main, say "main.f", that calls
> any subroutine included in the library, I simply type the following to
> compile
> % f77 main.f /home/Libraries/librecipes_f.a
> That command is too long to use frequently, so I alias the above using
> the following
> % alias nr77 'f77 \!:1 /home/Libraries/librecipes_f.a'
> With that, I can simply type
> % nr77 main.f
> to compile my main code.
> However, if my main program calls an additional subroutine, say
> "sub01.f", of my own, I have to use an alias that allows two (2)
> arguments as follows
> % alias nr277 'f77 \!:1 \!:2 /home/Libraries/librecipes_f.a'
> to issue my command
> % nr277 main.f sub01.f
> However, since the number of additional subroutines the main program
> may call is indefinite, how I can design an alias that allows
> insertion of an indefinite number of arguments between 'f77' and
> '/home/Libraries/librecipes_f.a' so that I can simply type
> % nrn77 main.f sub01.f sub02.f sub03.f ... sub0n.f
> that still includes the library?
> To put it simply, how do you design an alias that allows an indefinite
> number of arguments somewhere in the middle rather than at the end?
> Thanks.
How about reading the manpages of "make" and create a Makefile
instead ? That would have the benefit of documenting the
relationship between your modules.
The method you described is indeed smart, but it might be needless and
actualy cumbersome.
--
Peter Håkanson
IPSec Sverige ( At Gothenburg Riverside )
Sorry about my e-mail address, but i'm trying to keep spam out,
remove "icke-reklam" if you feel for mailing me. Thanx.
|
|
|
|
|