Re: assign a string variable onto itself with concat ksh



In article <1159408639.704728.268900@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>,
"theshowmecanuck" <theshowmecanuck@xxxxxxxxx> wrote:

Hi,
In a ksh script I would like to assign a string back onto itself
while concatenating another string to it... something like this:

optString="$optString$newString"

I have a string variable: $optString that has the value "r"

I then get another string variable: $newString that has a value of "o"

I would like to end up with optString having a value of "ro"

Works fine for me:

barmar $ optstring=r
barmar $ newstring=o
barmar $ optstring="$optstring$newstring"
barmar $ echo $optstring
ro

--
Barry Margolin, barmar@xxxxxxxxxxxx
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
*** PLEASE don't copy me on replies, I'll read them in the group ***
.



Relevant Pages

  • Re: assign a string variable onto itself with concat ksh
    ... In a ksh script I would like to assign a string back onto itself ... while concatenating another string to it... ... I would like to end up with optString having a value of "ro" ... unless you write a script and expect the variable to ...
    (comp.unix.shell)
  • assign a string variable onto itself with concat ksh
    ... In a ksh script I would like to assign a string back onto itself ... while concatenating another string to it... ... I would like to end up with optString having a value of "ro" ...
    (comp.unix.shell)
  • Re: To quote or unquote strings in an echo?
    ... However, for a double-quoted string with no dollar signs, the running time ... Complexity of both parsers will be Oin this case, ... using commas within echo() is a language construct. ... which leads us to the matter of concatenating stuff. ...
    (comp.lang.php)
  • Re: Create Table SQL not working
    ... Tim & Jeff seemed to be so ... > concatenating the Number (converted to a string) to the end of a constant ...
    (microsoft.public.access.tablesdbdesign)
  • Re: Advantage of Parameters
    ... the method where you are concatenating the string. ... new Parameter object, and then during the execution of the Command, it has to ...
    (microsoft.public.dotnet.framework.adonet)