linux – bash – 从中运行脚本的get目录

linux – bash – 从中运行脚本的get目录

所以我正在学习一些bash,我正在试图弄清楚如何从脚本运行目录.因为我有我的脚本/ scripts / bash / myscript,如果我执行我的scipt,如: user@localhost ~/dir/I/need/to/run/the/script/from $~/scripts/bash/myscript 从我的脚本中,如何获取正在执行它的目录