__key_value does not work with dash #263

Closed
opened 2021-11-20 15:22:50 +00:00 by ungleich-gitea · 0 comments

Created by: jimmyH

I had to add extra backslash characters to get this to work correctly. However this will break other machines which use a different shell for /bin/sh.

   --- a/cdist/conf/type/__key_value/gencode-remote
    +++ b/cdist/conf/type/__key_value/gencode-remote
    @@ -46,7 +46,7 @@ case "$state_should" in
                 ;;
                 wrongvalue)
                     # change exisiting value
    -                echo "sed \"s|^$key\($delimiter\+\).*|$key\1$value|\" \"$file\" > \"$file.cdist-tmp\""
    +                echo "sed \"s|^$key\($delimiter\+\).*|$key\\\1$value|\" \"$file\" > \"$file.cdist-tmp\""
                     echo "mv \"$file.cdist-tmp\" \"$file\""
                 ;;
                 *)
*Created by: jimmyH* I had to add extra backslash characters to get this to work correctly. However this will break other machines which use a different shell for /bin/sh. <pre> --- a/cdist/conf/type/__key_value/gencode-remote +++ b/cdist/conf/type/__key_value/gencode-remote @@ -46,7 +46,7 @@ case "$state_should" in ;; wrongvalue) # change exisiting value - echo "sed \"s|^$key\($delimiter\+\).*|$key\1$value|\" \"$file\" > \"$file.cdist-tmp\"" + echo "sed \"s|^$key\($delimiter\+\).*|$key\\\1$value|\" \"$file\" > \"$file.cdist-tmp\"" echo "mv \"$file.cdist-tmp\" \"$file\"" ;; *) </pre>
Sign in to join this conversation.
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: ungleich-public/cdist#263
No description provided.