From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 1070f0,5120b503df4ed78f X-Google-Attributes: gid1070f0,public X-Google-Thread: 11035d,5120b503df4ed78f X-Google-Attributes: gid11035d,public X-Google-Thread: 115614,5120b503df4ed78f X-Google-Attributes: gid115614,public X-Google-Thread: 1020c6,5120b503df4ed78f X-Google-Attributes: gid1020c6,public X-Google-Thread: 1012a6,5120b503df4ed78f X-Google-Attributes: gid1012a6,public X-Google-Thread: 1164f8,5120b503df4ed78f X-Google-Attributes: gid1164f8,public X-Google-Thread: 1069a6,5120b503df4ed78f X-Google-Attributes: gid1069a6,public X-Google-Thread: 10b612,5120b503df4ed78f X-Google-Attributes: gid10b612,public From: szh@zcon.com (Syed Zaeem Hosain) Subject: Re: Portable startup files question.. Date: 1995/05/26 Message-ID: <1995May26.151302.20206@zcon.com>#1/1 X-Deja-AN: 103352805 sender: szh@zcon.com (Syed Zaeem Hosain) references: organization: Z Consulting Group reply-to: szh@zcon.com newsgroups: comp.unix.solaris,comp.unix.ultrix,comp.unix.admin,comp.unix.shell,comp.unix.aix,comp.sys.sun.admin,comp.sys.dec,comp.s In article , ricky@fibronics.co.il (Ricardo Marek) writes: >How can I configure my startup files ( .cshrc, .login, .profile, .tcshrc) >in order to get arround with the differences between OS types. (setting paths, >environment vars, aliases, etc..), having also the possibility of seting particular >stuff for a certain machine/host/OS System? > >- Using `uname` is not the short way, because SunOS and Solaris have the same > identification. > >- Using tcsh $OSTYPE is not portable in machines that doesn't have tcsh.. > >Any hint for startup files using SunOS 4.*, Solaris 2.*, Ultrix, HPUX, AIX >with the account, but logging in in different machines? > >PLEASE ANSWER VIA E-MAIL To: ricky@fibronics.co.il Here is some of the very first lines in my .cshrc that allows me to deal with a similar problem. It is kludgey for sure, but it works for me and I do not have the time to change it: #!/bin/csh # # Set up some window environment variables: # set osbase = `uname` if ( $osbase == "SunOS" ) then set osver = `uname -r` if ( $osver == "4.1.3_U1revB" || $osver == "4.1.3_U1" || $osver == "4.1.3C" ) then set osver = "4.1.3" endif if ( $osver == "4.1.1" || $osver == "4.1.2" || $osver == "4.1.3" || $osver == "4.1.4" ) then set architecture = `/usr/bin/arch` set system = `/usr/bin/hostname` else if ( $osver == "5.0" || $osver == "5.1" || $osver == "5.2" || $osver == "5.3" || $osver == "5.4" ) then set architecture = `/usr/ucb/arch` set system = `/usr/ucb/hostname` else echo "Unknown osver = $osver" set system = "UNKNOWN" endif else if ( $osbase == "HP-UX" ) then set architecture = "hp" set system = `/bin/hostname` else if ( $osbase == "IRIX" ) then set architecture = "mips" set system = `uname -a | awk '{print $2}'` endif And after this code runs, I use "osbase", "architecture" and "system" later in the file to decide what to do (paths, environment vars, etc.). For example: # # OpenWindows environment variable: # if ( $osbase == "SunOS" ) then setenv OPENWINHOME /usr/openwin if (! $?CEPATH ) then setenv CEPATH "$HOME/.cetables:/etc/cetables:$OPENWINHOME/lib/cetables" endif set winpath = ($OPENWINHOME/bin $OPENWINHOME/bin/xview $OPENWINHOME/demo) else set winpath = () endif Note that some of the above are long lines and may wrap funny in your News reader. Sorry about that. Z -- ------------------------------------------------------------------------- | Syed Zaeem Hosain P. O. Box 610097 (408) 441-7021 | | Z Consulting Group San Jose, CA 95161 szh@zcon.com | -------------------------------------------------------------------------