Skip to content
  • hashworks's avatar
    Fix unexpected script_path behaviour · 6f0a15c3
    hashworks authored
    When one calls the `build.sh` scripts with bash instead of the shebang
    `$script_path` contains the filepath, not the parent dir:
    
    ```
    % cd /path
    % grep -A2 script_path= build.sh
    script_path=$(readlink -f "${0%/*}")
    echo "$script_path"
    exit 0
    % ./build.sh
    /path
    % bash build.sh
    /path/build.sh
    ```
    
    This commit fixes that:
    
    ```
    % grep -A2 script_path= build.sh
    script_path="$( cd -P "$( dirname "$(readlink -f "$0")" )" && pwd )"
    echo "$script_path"
    exit 0
    % ./build.sh
    /path
    % bash build.sh
    /path
    ```
    6f0a15c3