当我运行WLST
.sh
脚本进行如下设置env
时为什么我看不到更新的路径echo
?
[linbox2 bin]$ ./setWLSEnv.sh
CLASSPATH=/directory/ols_wls/patch_wlss1032/profiles/default/sys_manifest_classpath/weblogic_patch.jar:
/directory/ols_wls/patch_wls1032/profiles/default/sys_manifest_classpath/weblogic_patch.jar:
/directory/ols_wls/patch_oepe1032/profiles/default/sys_manifest_classpath/weblogic_patch.jar:
/directory/ols_wls/patch_ocm1031/profiles/default/sys_manifest_classpath/weblogic_patch.jar:
/directory/ols_wls/jrockit_160_14_R27.6.5-32/lib/tools.jar:
/directory/ols_wls/utils/config/10.3/config-launch.jar:
/directory/ols_wls/wlserver_10.3/server/lib/weblogic_sp.jar:
/directory/ols_wls/wlserver_10.3/server/lib/weblogic.jar:
/directory/ols_wls/modules/features/weblogic.server.modules_10.3.2.0.jar:
/directory/ols_wls/wlserver_10.3/server/lib/webservices.jar:
/directory/ols_wls/modules/org.apache.ant_1.7.0/lib/ant-all.jar:
/directory/ols_wls/modules/net.sf.antcontrib_1.0.0.0_1-0b2/lib/ant-contrib.jar:
PATH=/directory/ols_wls/wlserver_10.3/server/bin:
/directory/ols_wls/modules/org.apache.ant_1.7.0/bin:
/directory/ols_wls/jrockit_160_14_R27.6.5-32/jre/bin:
/directory/ols_wls/jrockit_160_14_R27.6.5-32/bin:
/usr/kerberos/bin:
/usr/local/bin:
/bin:
/usr/bin:
/usr/X11R6/bin:
/usr/java/j2sdk1.4.2_11/bin/bin:
/home/oracle/bin:
/directory/wls_olwcs/jdk160_14_R27.6.5-32/bin:
/directory/ccanywhere81/bin:/directory/oracle/oracle/product/10.2.0/client_1/bin
Your environment has been set.
[linbox2 bin]$ export CLASSPATH
[linbox2 bin]$ export PATH
[linbox2 bin]$ echo
$PATH
/usr/kerberos/bin:
/usr/local/bin:
/bin:
/usr/bin:
/usr/X11R6/bin:
/usr/java/j2sdk1.4.2_11/bin/bin:
/home/oracle/bin:
/directory/wls_olwcs/jdk160_14_R27.6.5-32/bin:
/directory/ccanywhere81/bin:
/directory/oracle/oracle/product/10.2.0/client_1/bin
[linbox2 bin]$
答案1
这是因为您正在执行此脚本。这意味着正在创建一个新的 shell 进程,并且定义或修改的变量仅在该子 shell 中有效。父进程不会继承子进程的环境。
每当你想要加载给定文件中定义的变量时,你必须source
这样做:
$ source file
或者
$ . file
答案2
您可以复制 CLASSPATH=.... 直到最后,然后进入终端执行
export CLASSPATH=...
或者你也可以在终端中执行以下操作
eval `./setWLSEnv.sh ` # this will set into your environment the CLASSPATH
您可以通过以下方式检查您的环境
env |grep CLASSPATH # look if it matches on what the ./setWLSEnv.sh sets