Re: multiple spaces in bash strings. [SOLVED]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On 7/12/25 3:17 AM, Francis Montagnac via users wrote:
On Sat, 12 Jul 2025 00:33:44 -0700
Samuel Sieb <samuel@xxxxxxxx> wrote:

On 7/12/25 12:18 AM, Francis Montagnac via users wrote:
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}\"."
It doesn't look like there are supposed to be any quotes.  It should
be simply:
echo "before if, endchars = ${endchars}."

I think that the OP wants to show the spaces in the endchars variable,
even the starting and ending ones, and thus adds a " before and after
it.

That said, he was backslashing properly the " in the previous
messages.

Thank-you, Francis and Samuel. I actually had that fixed several days ago, and it works as I want.

That echo is indeed for debugging. Francis is correct: I'm wanting to see if the desired spaces are there. I want the quotes in the output to make clear the start and end of the output of endchars.

I made this comment when showing his last message from the hyperkitty
web interface, but I found since that this interface do NOT show the
backslashes :-(

See my previous message: no backslashes around ${endchars}:

   https://lists.fedoraproject.org/archives/list/users@xxxxxxxxxxxxxxxxxxxxxxx/message/DFNN2E6SIRKBYPPEY2NB6AWKSZXYWMOO/

But it appears to be just a debugging statement anyway.

Right.

I just now fixed the "if" statement; it works as it should. I also changed it to a (hopefully) more clear form:

if [ -n "$endchars" ]; then   # if $endchars is not empty

--
_______________________________________________
users mailing list -- users@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to users-leave@xxxxxxxxxxxxxxxxxxxxxxx
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/users@xxxxxxxxxxxxxxxxxxxxxxx
Do not reply to spam, report it: https://pagure.io/fedora-infrastructure/new_issue



[Index of Archives]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [EPEL Devel]     [Fedora Magazine]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Desktop]     [Fedora Fonts]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Fedora Sparc]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux