string csh 上的自连接字符串
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/13818067/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-09 01:45:18 来源:igfitidea点击:
Self concatenate strings on csh
提问by abierto
I need to concatenate partial content from argv to one of my variable.
我需要将部分内容从 argv 连接到我的变量之一。
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.
当然,txt 文件上没有打印任何内容。有什么解决办法吗?谢谢。
回答by Andrew Cheong
Change
改变
set stringList = $stringList " " $param
to
到
set stringList = "$stringList $param"