Hi.
home user wrote:
> Here's the real code fragment:
> # 220 lines of code above here constructs string variables
> # line1, line2, line3, begchars, and endchars.
> line1="${begchars}${line1}"
> line2="${begchars} ${line2}"
> line3="${begchars} ${line3}"
> echo "before if, endchars = "${endchars}"."
Beware: word splitting will be done here when expanding ${endchars}
because the " before it closes the first "
You should quote the inner ":
echo "before if, endchars = \"${endchars}\"."
> if ! [ -z $endchars ]; then
Beware: this will raise an error: [: ...: binary operator expected
if endchars contains spaces.
Quote $endchars:
if ! [ -z "$endchars" ]; then
> echo "adding closing tags."
> line1="${line1}${endchars}"
> line2="${line2} ${endchars}"
> line3="${line3} ${endchars}"
> fi
> echo "line1="${line1}"."
Same remark than above for endchars.
--
_______________________________________________
users mailing list -- [email protected]
To unsubscribe send an email to [email protected]
Fedora Code of Conduct:
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives:
https://lists.fedoraproject.org/archives/list/[email protected]
Do not reply to spam, report it:
https://pagure.io/fedora-infrastructure/new_issue