can't source script in a current directory

后端 未结 3 861
不思量自难忘°
不思量自难忘° 2021-01-04 19:03

So apparently, I can\'t source a script if that script is in the current directory. For example,

# source some/dir/script.sh
Ok
<
3条回答
  •  太阳男子
    2021-01-04 19:34

    Quoting the source man page:

    source filename [arguments]

    ....

    If filename does not contain a slash, file names in PATH are used to find the directory containing file- name.

    So... source is trying to search your script.sh in the folders contained in PATH.

    If you want to source a file in the current folder use

    source ./script.sh
    

提交回复
热议问题