export str_opt="$(cat bi_sureyield_clicks_v.sql|tr '\n' ' ')"
sbt "run $str_opt"
我在gitlab-ci.yml文件中有此代码。我想在回购中提交一个sql文件时执行某项操作,并且由于该sql文件为\ n init,所以我将其截断,然后使用sbt run将其发送到scala项目中,但是在代码中我做了类似的事情
object printtest {
def main(args:Array[String]):Unit = {
println("HELLO WORLD SCALA" + args.length)
args.foreach{println}
}
}
并且显示长度> 1。它以\ n或空格作为新字符串的分隔符。如何在scala中将其作为单个字符串获取,以便可以使用查询并对其执行某些操作。我不想在Scala端编写代码。是否有可能使用bash或我做错了什么?
谢谢
您需要在双引号中添加转义的双引号,如下所示:
sbt "run \"$str_opt\""
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句