diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..c6f7cc1 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,23 @@ +# Changelog + +## Todo + +- [ ] Tests on different platforms (e.g. busybox) + +## [0.2](https://winklerfamilie.eu/git/efelon/rdlink/releases/tag/v0.2) - 2022-03-22 + +* Fix pattern substitution bugs (found with bash 3.2.57) +* Test successful on + * Ubuntu x86_64 (Ubuntu 20.04.4 LTS) + **GNU bash, version 3.2.57** + +## [0.1](https://winklerfamilie.eu/git/efelon/rdlink/releases/tag/v0.1) - 2022-03-22 + +* First relase +* behavior for normal cases same as readlink -f +* Tests successful on + * Raspberry Pi OS aarch64/arm64 (Debian GNU/Linux 11 (bullseye)) + **GNU bash, version 5.1.4** + * Ubuntu x86_64 (Ubuntu 20.04.4 LTS) + **GNU bash, Version 5.0.17** + diff --git a/rdlink.sh b/rdlink.sh index a51b6ed..7c85dbf 100755 --- a/rdlink.sh +++ b/rdlink.sh @@ -169,7 +169,7 @@ rl::cleanpath() { # Remove multiple / while [[ "${work:-}" = *"//"* ]]; do - work="${work//'//'/'/'}" + work="${work/\/\///}" done info " rl::cleanpath result: ${work}" @@ -191,7 +191,7 @@ rl::normalize() { # Remove /./ and /.$ sequences. rex_tmp='/\.(/|$)' while [[ "$work" =~ $rex_tmp ]]; do - work="${work/"${BASH_REMATCH[0]}"/"${BASH_REMATCH[1]/$//}"}" + work="${work/${BASH_REMATCH[0]}/${BASH_REMATCH[1]/$//}}" done # Remove leading ./ diff --git a/test/test_rdlink.sh b/test/test_rdlink.sh index e9c059a..8005157 100755 --- a/test/test_rdlink.sh +++ b/test/test_rdlink.sh @@ -47,7 +47,7 @@ rl::printPath() { local inputwidth=${config_path_width} if (( flag_extendedOutput )); then - printf -- "%-3d Inp: %-${config_path_width}s ---" ${testnum} "${input}" + printf -- "%-5d Inp: %-${config_path_width}s ---" ${testnum} "${input}" else # Truncate input string on the left if longer than $config_path_width if (( ${#input} > ${config_path_width} )) ; then @@ -97,7 +97,7 @@ rl::testcmp() { printf " %b\n" "${testresult_graphic}" if (( ! testresult )); then # Test failed - printf " Result: %s\n Exp: %s\n" "${actual}" "${expect}" + printf " Result: %s\n Exp: %s\n" "${actual}" "${expect}" if (( flag_verbose )); then [ -e "${input}" ] && printf "\n Subject:\n" && ls -al "${input}"