[Techtalk] command aliasing

Kathryn Hogg kjh at flyballdogs.com
Sat Mar 30 09:02:43 EST 2002


>> Currently,  when I compile something, I need to issue the following
>> command;
>>
>> g++ inputfilename -o /home/lyric340/bin/application
>>
>> what I was hoping to do was to alias this command with a variable for
>> inputfilename that would allow me to do this;
>>
>> compile inputfilename

>>
> I am sure there are a million possible solutions to this, but here is
> one I though of :)
>
> Its a bash script :)

You may as well just make your life easier in the long wrong and learn all
about make!  Create a file name makefile (or Makefile) in the directory
where inputfilename is:

# this is where we want to install binaries
INSTBINDIR = /home/lyric340/bin/
all: application

application: inputfile
g++ inputfilename -o application
# note: the whitespace before g++ above is a single TAB

install: application
rm -f $(INSTBINDIR)/application
cp application $(INSTBINDIR)
chmod 755 $(INSTBINDIR)/application


Then you can compile application by typing

$ make application   # or even just make because the first target "all"
# will cause application to be remade

Then install:

$ make install

--
Kathryn





More information about the Techtalk mailing list