Template Generation
Placeholder Replace
Fill One Slot
A small template can use a visible placeholder that the script replaces with a selected value. This keeps the fixed text separate from the changing value.
Program
Play the script to choose the deployment target and see the template filled in.
placeholder_replace.sh
#!/usr/bin/env bash
target=
template="deploy __TARGET__"
command="${template/__TARGET__/$target}"
echo "$command"
#!/usr/bin/env bash
target=
template="deploy __TARGET__"
command="${template/__TARGET__/$target}"
echo "$command"
placeholder
A placeholder marks the part of a template that will change.
parameter substitution
`${text/pattern/value}` replaces the first matching pattern in a string.
template boundary
Keeping fixed text in `template` makes the changing value easier to review.