Telling csh about multiple, machine-dependent libraries

Richard A. O'Keefe ok at quintus.uucp
Sat Nov 19 17:19:35 AEST 1988


>In article <173 at heart-of-gold>, jc at heart-of-gold (John M Chambers) writes:
>> 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)

Here's a script of mine that may help.  I would welcome any corrections
or additions.

#!/bin/sh
cat >machine <<'EOF'
#!/bin/sh
IFS=" 	"
#   Script : machine
#   Author : Richard A. O'Keefe
#   Purpose: Write the machine type on the standard output stream.
#
#   Copyright (C) 1988, Quintus Computer Systems, Inc.
#   This may be used freely provided this copyright notice is preserved.
#
#   There is a problem here.  I originally wrote
#	if [ -x /bin/FOO ] && /bin/FOO; then echo FOO
#   but the -x option does not exist on all systems.

if   [ -r /bin/sun     ] && /bin/sun     ; then
     # /bin/arch is not present in all versions of SunOS; local hack.
     if [ -r /bin/arch ] && /bin/arch >/dev/null ; then
	/bin/arch
    else
	echo sun2
    fi
elif [ -r /bin/apollo  ] && /bin/apollo  ; then
    # No test for DN10000 yet, only 680x0 models.
    echo apollo
elif [ -r /bin/s5k30  ] && /bin/s5k30    ; then
    # Recognise Unisys 5000/X machines with "s5k*)"
    # Unisys 5000/30
    echo s5k30
elif [ -r /bin/s5k50  ] && /bin/s5k50    ; then
    # Unisys 5000/50
    echo s5k50
elif [ -r /bin/s5k80  ] && /bin/s5k80    ; then
    # Unisys 5000/80
    echo s5k80
elif [ -r /bin/s5k85  ] && /bin/s5k85    ; then
    # Unisys 5000/30
    echo s5k85
elif [ -r /bin/s5k90  ] && /bin/s5k90    ; then
    # Unisys 5000/90
    echo s5k90
elif [ -r /bin/s5k95  ] && /bin/s5k95    ; then
    # Unisys 5000/95
    echo s5k95
elif [ -r /bin/s7k40  ] && /bin/s7k40    ; then
    # Recognise Unisys 7000/X machines with "s7k*)"
    # Recognise both groups with "s?k*)"
    # Unisys 7000/40 or 7000/30
    echo s7k40
elif [ -r /bin/s7k50  ] && /bin/s7k50    ; then
    # Unisys 7000/50
    echo s7k50
elif [ -r /bin/s7k51  ] && /bin/s7k51    ; then
    # Unisys 7000/51
    echo s7k51
elif [ -r /bin/s7k52  ] && /bin/s7k52    ; then
    # Unisys 7000/52
    echo s7k52
elif [ -r /bin/m68k    ] && /bin/m68k    ; then
    # "other" Motorola 680x0, probably System V/68
    echo m68k
elif [ -r /bin/vax     ] && /bin/vax     ; then
    echo vax
elif [ -r /bin/i386    ] && /bin/i386    ; then
    # This covers Sequent and Intel machines at least
    echo i386
elif [ -r /bin/i286    ] && /bin/i286    ; then
    echo i286
elif [ -r /bin/ns32000 ] && /bin/ns32000 ; then
    echo ns32000
elif [ -r /bin/u3b15   ] && /bin/u3b15   ; then
    # Recognise 3B machines in general with "3b*)"
    echo u3b15
elif [ -r /bin/u3b10   ] && /bin/u3b10   ; then
    echo u3b10
elif [ -r /bin/u3b5    ] && /bin/u3b5    ; then
    echo u3b5
elif [ -r /bin/u3b2    ] && /bin/u3b2    ; then
    echo u3b2
elif [ -r /bin/u3b     ] && /bin/u3b     ; then
    # Actually, 3B/20
    echo u3b
elif [ -r /bin/u370    ] && /bin/u370    ; then
    echo u370
elif [ -r /bin/pdp11   ] && /bin/pdp11   ; then
    echo pdp11
else
    echo unknown
    exit 1
fi
exit 0
EOF
chmod a=rx machine
exit 0



More information about the Comp.unix.questions mailing list