[Cialug] sed question

Todd Walton tdwalton at gmail.com
Wed Sep 21 14:57:08 UTC 2022


What am I doing wrong here? I set two variables and then try to use them in
a sed line to update a file. But I get "unterminated s command". I'm sure
it's some stupid shell quoting thing.

> todd:[~]> printf -v starparen "\x2A\x29"
>
> todd:[~]> printf -v gitrun
'%s\n%s\n%s\x22%s\x22\n%s\x22\x24%s\x22\n%s\n\n%s' "gitlab-runner)" "
shift" "       echo " "Running Runner" "       gitlab-runner " "{@}" "
;;" "     *)"
>
> todd:[~]> echo ${starparen}
> *)
>
> todd:[~]> echo "${gitrun}"
> gitlab-runner)
>        shift
>        echo "Running Runner"
>        gitlab-runner "${@}"
>      ;;
>
>      *)
>
> todd:[~]> sed -i.bak "s,${starparen},${gitrun},g" script.sh
> sed: -e expression #1, char 19: unterminated 's' command

Any suggestions? Any ideas about what's going awry?

--
Todd


More information about the Cialug mailing list