Self concatenate strings on csh

拟墨画扇 提交于 2019-12-01 22:06:57

问题


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.


回答1:


Change

        set stringList = $stringList " " $param

to

        set stringList = "$stringList $param"


来源:https://stackoverflow.com/questions/13818067/self-concatenate-strings-on-csh

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!