[comp.unix.programmer] Alias to change path on the fly - ALTERNATIVE

paul@ixi.uucp (Paul Davey) (11/10/90)

In article <1990Nov8.014515.13882@cpsc.ucalgary.ca> paquette@cs-sun-fsa.cpsc.ucalgary.ca (Trevor Paquette) writes:

->    Quick and I hope a fairly simple question. We have some programs
->   that must be able to take advantage of two co-processors on a sun.
->   The executables are name prog_host (no coprocessor), prog_sc (Supercard
->   coprocessor) and prog_qc (Quickcard coprocessor).
->    Each executable is in a seperate directory. I want to be able to change
->   my path on the fly to get at a certain executable. This is what I have
->   done so far.
->   Let's say my path is set as :
->   (. /usr/ucb /bin /usr/bin /usr/local/bin /home/insight/sparc/bin/itahost)
...

lots of mucking around with sed deleted...

As an alternative solution I'd use a symbolic link to the bin and
delete it and recreate it as required.

if your three bins are: /home/insight/sparc/bin/itahost
			/home/insight/sparc/bin/itaqc
			/home/insight/sparc/bin/itasc

set path = (. /usr/ucb /bin /usr/bin /usr/local/bin ~/itabin)

alias host  'rm -f  ~/itabin ; ln -s /home/insight/sparc/bin/itahost'
alias qc    'rm -f  ~/itabin ; ln -s /home/insight/sparc/bin/itaqc'
alias sc    'rm -f  ~/itabin ; ln -s /home/insight/sparc/bin/itasc'

(you don't need to rehash, at least not on my machine)
--
 Regards,			 pd@x.co.uk          IXI Limited
	Paul Davey		 pd@ixi.uucp         62-74 Burleigh St.
				 ...!uunet!ixi!pd    Cambridge  U.K.
 "These are interesting times"   +44 223 462 131     CB1  1OJ      

goer@quads.uchicago.edu (Richard L. Goerwitz) (11/12/90)

In <PAUL.90Nov10154152@cheshire.ixi.uucp> paul@ixi.uucp (Paul Davey) writes:

>As an alternative solution I'd use a symbolic link to the bin and
>delete it and recreate it as required.

Ln -s isn't portable, as I'm sure you know.  Hmmm.

-Richard

greywolf@unisoft.UUCP (The Grey Wolf) (11/15/90)

In article <1990Nov11.193202.6051@midway.uchicago.edu> goer@quads.uchicago.edu (Richard L. Goerwitz) writes:
>In <PAUL.90Nov10154152@cheshire.ixi.uucp> paul@ixi.uucp (Paul Davey) writes:
>
>>As an alternative solution I'd use a symbolic link to the bin and
>>delete it and recreate it as required.
>
>Ln -s isn't portable, as I'm sure you know.  Hmmm.
>
>-Richard

Symlinks *not PORTABLE*???? on a SUN?  You must be kidding.  Even SVR4
supports symlinks these days.


-- 
"This is *not* going to work!"
				"Well, why didn't you say so before?"
"I *did* say so before!"
...!{ucbvax,acad,uunet,amdahl,pyramid}!unisoft!greywolf

guy@auspex.auspex.com (Guy Harris) (11/18/90)

>Symlinks *not PORTABLE*????

No, symlinks *aren't* portable, at least not to all UNIX systems widely
used today.

>on a SUN?

Yes, they are supported on all flavors of SunOS (dunno about the
original Unisoft V7 for the Sun, but only people trying to be perverse
would call that SunOS), so the person who originally asked the question
could use them assuming they'd use them only on the Suns to which they
referred or on other systems whose OS supported them.

>You must be kidding.  Even SVR4 supports symlinks these days.

Sure does, but S5R3 as it comes from AT&T doesn't, and there are lots of
systems running S5R3 systems that haven't had symlink support added.

In other words, symlinks aren't portable to all UNIX systems widely used
today.  This may change in the future.