所以,我真的很喜欢Fish --但是我需要一些脚本方面的帮助。尤其是找到正在运行的脚本的路径。
以下是BASH Getting the source directory of a Bash script from within的解决方案
有人能帮我找到鱼的等价物吗?
发布于 2015-12-05 10:37:17
在鱼壳里,
set DIR (cd (dirname (status -f)); and pwd) 是与BASH one衬垫等效的
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"在Can a Bash script tell what directory it's stored in?中提到过。
注:鱼壳将cd进入该dir,并停留在那里。Bash将cd,但它将保留在子命令中。
https://stackoverflow.com/questions/19672673
复制相似问题