1.sh ##(该sh 目的是 将变量env传入env.sh, 同时让env.sh在当前事物生效,最后执行env.sh 定义的变量envs)
export ENV=prepare
echo $ENV
. env.sh
echo $ENVS
env.sh
#!/bin/bash
# config all schema env in this file
echo $ENV
case $ENV in
rollout)
# UAT
export NLS_LANG=AMERICAN_AMERICA.UTF8
export ENVS=/dbuatdb/change/env/env_dbuat_uat.sql
export SCHEMA_HOME=/dbuatdb/change/schema/2016_10_11_2016.2
export SCHEMA_HOME_70600=$SCHEMA_HOME/REL-007-06-000/db/schema_changes/db/rollout
export SCHEMA_HOME_70605=$SCHEMA_HOME/REL-007-06-005/db/schema_changes/db/rollout
# PROD
#export NLS_LANG=AMERICAN_AMERICA.UTF8
#export ENVS=/dbproddb/change/env/env_dbprod.sql
#export SCHEMA_HOME=/dbproddb/change/schema/2016_05_10_2016.2
#export SCHEMA_HOME_70400=$SCHEMA_HOME/REL-007-04-000/db/schema_changes/db/rollout
#export SCHEMA_HOME_70500=$SCHEMA_HOME/REL-007-05-000/db/schema_changes/db/rollout
echo r
;;
prepare)
# UAT
export NLS_LANG=AMERICAN_AMERICA.UTF8
export ENVS=/dbuatdb/change/env/env_dbuat_uat.sql
export SCHEMA_HOME=/dbuatdb/change/schema/2016_10_11_2016.2
export SCHEMA_HOME_70600=$SCHEMA_HOME/REL-007-06-000/db/schema_changes/db/prepare
export SCHEMA_HOME_70605=$SCHEMA_HOME/REL-007-06-005/db/schema_changes/db/prepare
# PROD
#export NLS_LANG=AMERICAN_AMERICA.UTF8
#export ENVS=/dbproddb/change/env/env_dbprod.sql
#export SCHEMA_HOME=/dbproddb/change/schema/2016_05_10_2016.2
#export SCHEMA_HOME_70400=$SCHEMA_HOME/REL-007-04-000/db/schema_changes/db/prepare
#export SCHEMA_HOME_70500=$SCHEMA_HOME/REL-007-05-000/db/schema_changes/db/prepare
echo p
;;
regress)
# UAT
export NLS_LANG=AMERICAN_AMERICA.UTF8
export ENVS=/dbuatdb/change/env/env_dbuat_uat.sql
export SCHEMA_HOME=/dbuatdb/change/schema/2016_05_10_2016.2
export SCHEMA_HOME_70400=$SCHEMA_HOME/REL-007-04-000/db/schema_changes/db/regress
export SCHEMA_HOME_70500=$SCHEMA_HOME/REL-007-05-000/db/schema_changes/db/regress
# PROD
#export NLS_LANG=AMERICAN_AMERICA.UTF8
#export ENVS=/dbproddb/change/env/env_dbprod.sql
#export SCHEMA_HOME=/dbproddb/change/schema/2016_05_10_2016.2
#export SCHEMA_HOME_70400=$SCHEMA_HOME/REL-007-04-000/db/schema_changes/db/regress
#export SCHEMA_HOME_70500=$SCHEMA_HOME/REL-007-05-000/db/schema_changes/db/regress
echo re
;;
*) echo 'please use right option'
;;
esac
FAQ
1.http://blog.csdn.net/simon_dong618/article/details/1581132
source命令:
source命令也称为“点命令”,也就是一个点符号(.)。source命令通常用于重新执行刚修改的初始化文件,使之立即生效,而不必注销并重新登录。
用法:
source filename 或 . filename
source命令除了上述的用途之外,还有一个另外一个用途。在对编译系统核心时常常需要输入一长串的命令,如
2.http://blog.csdn.net/dreamcoding/article/details/8519708
3.http://www.cnblogs.com/ghgyj/p/4023448.html
手机扫一扫
移动阅读更方便
你可能感兴趣的文章