-
Notifications
You must be signed in to change notification settings - Fork 0
/
.kshrc.architecture
122 lines (107 loc) · 3.13 KB
/
.kshrc.architecture
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
# File: $HOME/.kshrc.architecture
# Usage: called by .kshrc FOR ALL ksh's
# (q?) ONLY ONCE
# Description The idea is that my environment should run UNCHANGED
# from architecture to architecture, EVEN using one $HOME
# for many architectures CONCURRENTLY
# See Also "configure" $HOME/.kshrc.aliases, .kshrc.fns, ....
# scripts/tell.machine.architecture
# Methods Used o the PATH env uses $MYBIN to access the right arch binaries
# o scripts must be written to :
# o use ENV VARs config. the use for the arch., eg
# $AWK to awk on some architecture and nawk on others
# o if this can't be done they should case $UNAME
# o failing this, they should try to detect themselves
#
#
#
##set -x
#
# M a c h i n e A r c h i t e c t u r e
#
UNAME=$(uname); export UNAME
case $UNAME in
SunOS)
pingtest() {
ping $* 3;
}
AWK="nawk";
WHOAMI_BIN="/usr/ucb/whoami";
WHOAMI=`$WHOAMI_BIN`;
HOSTNAME=`hostname`
HOSTNAME="${HOSTNAME%%.*}"; #To take away any .domain part
typeset UNAME_R=$(uname -r);
typeset -i numdigits=$(print $UNAME_R | wc -c);
if [ $numdigits -gt 4 ] ; then
UNAME_R=${UNAME_R%%.?}; # Change 5.5.1 to 5.5
fi
case $UNAME_R in
4.*) # SunOS (NOT Solaris)
MYBIN=$HOME/bin.sunos;
;;
5.*) # Solaris
MYBIN=$HOME/bin.solaris$UNAME_R;
. $HOME/.kshrc.arch.solaris;
## alias grep="/usr/xpg4/bin/grep";
;;
*) print "Unrecognised ver. of Solaris!";
;;
esac;
;; #break;;
OSF1)
## AWK="gawk"; #gawk is another alternative also at /usr/bin
AWK="nawk";
MYBIN=$HOME/bin.osf1;
WHOAMI_BIN=`id -un`; # an alternative
WHOAMI_BIN=`whoami`
WHOAMI=`$WHOAMI_BIN`;
HOSTNAME=`hostname -s`
;; #break;;
hpux)
AWK="nawk";
MYBIN=$HOME/bin.hpux;
WHOAMI_BIN=`id -un`
WHOAMI=`$WHOAMI_BIN`;
HOSTNAME=`hostname`
;; #break;;
aix|AIX)
pingtest() {
ping -c 1 -w 1 $*;
return $?
}
AWK="awk";
MYBIN=$HOME/bin.aix;
WHOAMI_BIN="id -un";
WHOAMI=`$WHOAMI_BIN`;
## HOSTNAME=`hostname -s`
HOSTNAME=`hostname`
;; #break;;
CYGWIN*)
AWK="gawk";
MYBIN=$HOME/bin.cygwin;
WHOAMI_BIN='id -un';
WHOAMI=`id -un`;
## HOSTNAME=`hostname -s`
HOSTNAME=`hostname`
alias xt="rxvt -fn 10x16 -bg black -fg yellow -e /bin/ksh";
alias convconv="cygpath";
;; #break;;
Linux)
AWK="gawk";
MYBIN="$HOME/bin.linux";
WHOAMI_BIN="id -un";
WHOAMI=`$WHOAMI_BIN`;
HOSTNAME=`hostname -s`;
PATH="/usr/local/sbin:/usr/sbin:/sbin:/usr/kerberos/sbin:/usr/kerberos/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:/usr/bin/X11:/usr/X11R6/bin:/root/bin:$PATH";
MANPATH=""; # Best to leave empty with linux
## HOSTNAME=`hostname`
;; #break;;
*)
#Defaults for an ONKNOWN o/s
print "Ummm have come across this unix arch before... ";
AWK="awk"; #how about if nawk then nawk else awk
MYBIN=$HOME/bin;
;;
esac;
export AWK MYBIN WHOAMI_BIN
##AWK="nawk" # hpux