Search code examples
stringshellconcatenationcshargv

Self concatenate strings on csh


I need to concatenate partial content from argv to one of my variable.

I will show you my code:

#!/bin/csh

set stringList = ""
foreach param ($argv)
    if($param !~ TEST) then
        set stringList = $stringList " " $param
    endif
end

echo $stringList > /tmp/prova.txt

Of course, nothing is printed on the txt file. Any solution? Thanks.


Solution

  • Change

            set stringList = $stringList " " $param
    

    to

            set stringList = "$stringList $param"