Path: utzoo!attcan!uunet!husc6!linus!heart-of-gold!jc From: jc@heart-of-gold (John M Chambers) Newsgroups: comp.unix.questions Subject: Telling csh about multiple, machine-dependent libraries Keywords: csh bin libraries Message-ID: <173@heart-of-gold> Date: 16 Nov 88 17:47:19 GMT Organization: Mitre Corp, Bedford, MA, USA Lines: 40 Here's one that someone has gotta have solved already: We have NFS-mounted filesystems on a lot of different kinds of machines, and of course there is a problem with trying to execute binary files on the wrong machine. It's pretty easy to build the binaries, of course; I just set up a heirarchy: ~foo/src contains generic source. ~foo/sun2 contains a Makefile and binaries for a Sun2 ~foo/sun3 contains a Makefile and binaries for a Sun3 ~foo/vax contains a Makefile and binaries for a VAX ~foo/x286 contains a Makefile and binaries for a 80286/Xenix ~foo/x386 contains a Makefile and binaries for a 80386/Xenix and so on. Source files are linked from src as necessary. Now, when I log in, I'd like to include the right directory in my search path. My latest (failed) attempt in cshrc looks like: | set mtype = bin | if (`sun2`) set mtype = sun2 | if (`sun3`) set mtype = sun3 | if (`sun4`) set mtype = sun4 | set path=(. ~/{$mtype,sh,csh,awk} /bin /usr/{ucb,etc,local,local/{$mtype,sh},bin,lib,dos,hosts,games,demo,NeWS/{bin,demo}} /etc) Note that the replicated binary directories are also in /local, as a simple way of getting public libraries. Anyhow, as I said, the above code doesn't work. While the `sun3` command on this 3/260 returns TRUE (i.e., 0), the value of $path includes ~/bin, not ~/sun3. I've tried a few other variants, includeing such things as sun3 && set mtype = sun3 all to no avail. Does anyone know how to do this right? For that matter, the above code, if taken to a machine that lacks, e.g., a `sun4` command, bombs out and fails to read the rest of .cshrc, so this is obviously not a general approach. In reading the manuals, I haven't been able to find any way of answering the question "What the hell sort of CPU am I running on, anyway?" I also don't recall ever reading any flame session (oops, I mean in-depth technical discussion) of the topic on usenet. Is there a portable answer to this question?