# 脚本中获取脚本文件所在的绝对路径 ```bash #!/bin/sh #获取当前文件路径 shellPath=$(cd "$(dirname "$0")"; pwd) cd $shellPath ```