Self concatenate strings on csh

abierto picture abierto · Dec 11, 2012 · Viewed 28.6k times · Source

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.

Answer

slackwing picture slackwing · Dec 11, 2012

Change

        set stringList = $stringList " " $param

to

        set stringList = "$stringList $param"