Skip to content

Improve portability

Jakub Jirutka requested to merge jirutka/alpine-conf:fix-portability into master

replace 'echo -n' and 'echo -e' with printf

'echo -n' and 'echo -e' are not portable, not all commonly used shells support both of them (in the same way). 'echo -e' is not even defined in POSIX.

https://pubs.opengroup.org/onlinepubs/009604599/utilities/echo.html:

New applications are encouraged to use printf instead of echo. ... Conforming applications that wish to do prompting without s or that could possibly be expecting to echo a -n, should use the printf utility derived from the Ninth Edition system.

setup-alpine: fix error when -f doesn't contain a slash

When running tests with /bin/sh -> /usr/bin/yash:

===> tests/setup_alpine_test:setup_alpine_create_answerfile
Executing command [ setup-alpine -f answers ]
Fail: incorrect exit status: 1, expected: 0
stdout:

stderr:
.: file `answers' was not found in $PATH

https://pubs.opengroup.org/onlinepubs/009695299/utilities/dot.html:

If file does not contain a slash, the shell shall use the search path specified by PATH to find the directory containing file.

Edited by Jakub Jirutka

Merge request reports