From: szh@zcon.com (Syed Zaeem Hosain)
Subject: Re: Portable startup files question..
Date: 1995/05/26 [thread overview]
Message-ID: <1995May26.151302.20206@zcon.com> (raw)
In-Reply-To: D8xA28.L5n@fibronics.co.il
In article <D8xA28.L5n@fibronics.co.il>, 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 |
-------------------------------------------------------------------------
prev parent reply other threads:[~1995-05-26 4:00 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
1995-05-21 4:00 Portable startup files question Ricardo Marek
1995-05-21 4:00 ` Uwe Leinberger
1995-05-22 4:00 ` Ido Sarig
1995-05-22 4:00 ` Guy Harris
1995-05-24 4:00 ` Dale DePriest
1995-05-25 4:00 ` Guy Harris
1995-05-26 4:00 ` Thanh Ma
1995-05-26 4:00 ` Guy Harris
1995-06-02 4:00 ` Christopher Samuel
1995-05-21 4:00 ` tim werner
1995-05-22 4:00 ` Guy Harris
1995-05-23 4:00 ` Larry Gale
1995-05-26 4:00 ` Syed Zaeem Hosain [this message]
read-only archive
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox