windows及linux脚本定位所在目录

windows下:

@echo off
cd /d %~dp0

将工作目录转至bat脚本所在的目录。

linux下:

currentDir=`dirname $0`

currentDir好为脚本所在的目录

如果有其它shell设置了环境变量则使用以下方式调用

. $shellPath/../tools/db_load_init.sh

发表评论?

0 条评论。

发表评论


注意 - 你可以用以下 HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>