help-bash
[Top][All Lists]
Advanced

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

Re: Appending a string


From: michael-franzese
Subject: Re: Appending a string
Date: Thu, 8 Apr 2021 19:42:43 +0200

Thank you Greg,

> Sent: Thursday, April 08, 2021 at 11:39 PM
> From: "Greg Wooledge" <greg@wooledge.org>
> To: help-bash@gnu.org
> Subject: Re: Appending a string
>
> On Thu, Apr 08, 2021 at 10:20:54AM +0200, michael-franzese@gmx.com wrote:
> > Have coded a function that takes a string as argument, and returns another 
> > string.
> > Then I need to append another string.
> >
> > Have done as follows, but worry that how I use " could mess things up.
> >
> > fmt="$(clfmt "su--oe")${rc}"
>
> What you've got here is 100% correct.  You could simplify it by removing
> the curly braces and all of the quotes, but it's fine as is.
>
> Breaking it down:
>
> $rc and ${rc} are equivalent when there is no text following the rc
> that could be mistaken for a continuation of the variable name.
>
> No quotes are necessary around the string su--oe because it doesn't
> contain any shell metacharacters.
>
> No quotes are necessary around the right hand side of an assignment in
> the absence of whitespace, assuming you want substitutions to occur.
>
>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]