valosekj / fsleyes_preset

Run FSLeyes and automatically set display options
GNU General Public License v3.0
0 stars 0 forks source link

Get script_path for both Linux and Darwin #3

Open valosekj opened 3 years ago

valosekj commented 3 years ago

Replace following line https://github.com/valosekj/fsleyes_preset/blob/aeb213bae2052ea6278b5e3bccbb2e78e7180323/fsleyes_preset.sh#L18

by

if [[ $(uname) == "Linux" ]];then
    script_path=$(dirname $(realpath -s $0))
elif [[ $(uname) == "Darwin" ]];then
    script_path=$(dirname $(readlink $0))
fi
valosekj commented 3 years ago

Okay, it was not related to Darwin and Linux but to zsh and bash, fixed in https://github.com/valosekj/fsleyes_preset/commit/e40673415f0ff415433fa9695a214fd2f8fdf29a

valosekj commented 3 years ago

Hm, it looks that

script_path=$(dirname $(readlink "$0"))

works for both zsh and bash.

Switched to this syntax for all shells and OS in https://github.com/valosekj/fsleyes_preset/commit/b876c55d64b6a4c245ab7fcfe8d09942b63e0f8c

valosekj commented 2 years ago

On Debian, following command does not work:

https://github.com/valosekj/fsleyes_preset/blob/6606079f7329e953d55f918b9a5a6feb7bbf42a0/fsleyes_preset.sh#L22

The command returns empty variable, the working command is:

https://github.com/valosekj/fsleyes_preset/blob/6606079f7329e953d55f918b9a5a6feb7bbf42a0/fsleyes_preset.sh#L20

Fixed back in https://github.com/valosekj/fsleyes_preset/commit/96607da3bde6d13b36e0558b50aeaae6044ea41f

Some notes:

valosekj commented 1 year ago

On macOS Ventura 13.0, /bin/zsh, iTerm2, the following is working:

script_path=$(dirname $(realpath "$0"))