Recently in Development Category
前提是bash脚本不能是一个symbolic link。用下面的代码,先通过which $0的到脚本所在的绝对路径,然后再通过dirname拿到脚本所在的目录
#!/bin/sh
BASE_PATH=$(dirname `which $0`)
前提是bash脚本不能是一个symbolic link。用下面的代码,先通过which $0的到脚本所在的绝对路径,然后再通过dirname拿到脚本所在的目录
#!/bin/sh
BASE_PATH=$(dirname `which $0`)
Recent Comments
cnhackTNT on 用正则表达式Look-Ahead做带逃逸的变量替换: 晕,被过滤掉了,再试
cnhackTNT on 用正则表达式Look-Ahead做带逃逸的变量替换: s/(? 这样可以
R.Q. on 个性化SSH登录: 酱紫哦,了了 ---