Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

butch scripts use readlink -f which is not posix #575

Open
rofl0r opened this issue Mar 13, 2018 · 1 comment
Open

butch scripts use readlink -f which is not posix #575

rofl0r opened this issue Mar 13, 2018 · 1 comment

Comments

@rofl0r
Copy link
Member

rofl0r commented Mar 13, 2018

... so it may currently not be used on Mac OS X, and maybe some BSDs...

TODO: find portable way to achieve the same

readlink_f() {
readlink "$1" || printf "%s\n" "$1" | sed -e 's,\\,/,g'
}

this possible candidate works for the cases where readlink doesn't return anything, and the program is in $PATH, but not for the case of relative symlinks: e.g.

$ readlink /bin/butch
../opt/sabotage-core/bin/butch
@rofl0r
Copy link
Member Author

rofl0r commented Mar 20, 2018

hoping that @nero soon completes his https://github.com/nero/realpath.sh ..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant