-
Notifications
You must be signed in to change notification settings - Fork 21
/
Copy pathttquickstartenv.zsh
99 lines (86 loc) · 2.05 KB
/
ttquickstartenv.zsh
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
#
# Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved.
#
# Licensed under the Universal Permissive License v 1.0 as shown
# at http://oss.oracle.com/licenses/upl
#
# Oracle TimesTen 22.1 Quick Start Sample Program Environment setup script.
#
if [[ ! ${ZSH_EVAL_CONTEXT} =~ :file$ ]]
then
echo "Please 'source' this script; do not run it as a regular script."
exit 1
fi
#
# Edit and uncomment the line below to have this script automatically
# source the TimesTen environment script.
#
# source <tt_instance_home>/bin/ttenv.sh
#
canonPath()
{
local cwd nwd nfn
cwd=$(pwd -P)
nwd=$(dirname "$1")
nfn=$(basename "$1")
if ! cd "${nwd}" >&/dev/null
then
cd "${cwd}"
return 1
fi
nwd=$(pwd -P)
if [[ -d "${nfn}" ]]
then
if ! cd "${nfn}" >&/dev/null
then
cd "${cwd}"
return 1
fi
nwd=$(pwd -P)
echo "${nwd}"
else
echo "${nwd}/${nfn}"
fi
cd "${cwd}"
return 0
}
if [[ -z "${TIMESTEN_HOME}" ]]
then
echo "TIMESTEN_HOME has not been defined. Did you source ttenv.sh?"
return 2
elif [[ ! -e "${TIMESTEN_HOME}/bin/ttenv.sh" ]]
then
echo "TIMESTEN_HOME is not set correctly. Did you source ttenv.sh?"
return 2
fi
QUICKSTART_HOME=$(canonPath "${(%):-%x}")
QUICKSTART_HOME=$(dirname "${QUICKSTART_HOME}")
if [[ "${QUICKSTART_HOME}" == "." ]]
then
QUICKSTART_HOME=$(pwd)
fi
if [[ -z "${QUICKSTART_HOME}" ]]
then
echo "Unable to determine QuickStart install location"
return 3
fi
export QUICKSTART_HOME
echo
echo "TIMESTEN_HOME=${TIMESTEN_HOME}"
echo
echo "QUICKSTART_HOME=${QUICKSTART_HOME}"
export PATH="${QUICKSTART_HOME}/sample_code/odbc/bin:${QUICKSTART_HOME}/sample_code/jdbc:${QUICKSTART_HOME}/sample_code/database:${PATH}"
export CLASSPATH="${QUICKSTART_HOME}/sample_code/jdbc${CLASSPATH:+:${CLASSPATH}}"
echo
echo "PATH=${PATH}"
echo
echo "CLASSPATH=${CLASSPATH}"
echo
if [ -z "${TNS_ADMIN}" ]
then
echo "TNS_ADMIN is not set"
else
echo "TNS_ADMIN=${TNS_ADMIN}"
fi
echo
return 0