commit:     a511a48d77b1dcb8a3fb0dd1abddb750a152869b
Author:     Nuno Silva <nuno.m.ribeiro.silva <AT> tecnico <DOT> ulisboa <DOT> 
pt>
AuthorDate: Sat Jun 10 02:12:49 2017 +0000
Commit:     William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Mon Jun 12 15:44:27 2017 +0000
URL:        https://gitweb.gentoo.org/proj/openrc.git/commit/?id=a511a48d

init.d/hostname: fix default parameter syntax

The syntax for expanding a variable with a default value is
        ${parameter:-word}
not
        ${parameter-word}
although the latter still works for a reason I could not explain.

This fixes #143.

 init.d/hostname.in | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/init.d/hostname.in b/init.d/hostname.in
index c144a710..d7913bed 100644
--- a/init.d/hostname.in
+++ b/init.d/hostname.in
@@ -26,7 +26,7 @@ start()
        else
                # HOSTNAME variable used to be defined in caps in 
conf.d/hostname.
                # It is also a magic variable in bash.
-               h=${hostname-${HOSTNAME}} # checkbashisms: false positive
+               h=${hostname:-${HOSTNAME}} # checkbashisms: false positive 
(HOSTNAME var)
        fi
        if [ -z "$h" ]; then
                einfo "Using default system hostname"

Reply via email to