庆典:我怎样才能组装字符串:`"文件名= output_0.csv"` [英] bash: How can I assemble the string: `"filename=output_0.csv"`

查看:201
本文介绍了庆典:我怎样才能组装字符串:`"文件名= output_0.csv"`的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的是bash脚本来执行的程序。该程序必须采取以下参数。 (该方案是gnuplot的。)

I am using a bash script to execute a program. The program must take the following argument. (The program is gnuplot.)

gnuplot的-e文件名='output_0.csv'plot.p

我需要能够组装以下字符串:文件名='output_0.csv'

I need to be able to assemble the following string: "filename='output_0.csv'"

我的计划是组装字符串STRING = 文件名='output_0.csv',然后执行以下操作: gnuplot的-r$ STRING 'plot.p。请注意,我离开的话STRING没有计算器的语法高亮风格,强调我要产生字符串。

My plan is to assemble the string STRING=filename='output_0.csv' and then do the following: gnuplot -r "$STRING" 'plot.p'. Note I left the words STRING without stackoverflow syntax style highlighting to emphasise the string I want to produce.

我不是在打击特别精通,所以我不知道如何做到这一点。

I'm not particularly proficient at bash, and so I have no idea how to do this.

我觉得字符串可以使用 STRING =$ STRING的东西附加到字符串被串联?我认为,可能需要?

I think that strings can be concatenated by using STRING="$STRING"stuff to append to string? I think that may be required?

作为的并发症的额外的一层的0值实际上是应当由1每次程序运行时增加一个整数。 (由一个完成的循环。)如果我有 N = 1 在我的计划,我怎能取代 0 由字符串值或整数n的纯文字版的字符串?

As an extra layer of complication the value 0 is actually an integer which should increment by 1 each time the program is run. (Done by a for loop.) If I have n=1 in my program, how can I replace the 0 in the string by the "string value" or text version of the integer n?

推荐答案

这是答案贴出来,我以为我已经接受,但由于某种原因已被删除,可能是因为它并没有完全回答这个问题。

An answer was posted, which I thought I had accepted already, but for some reason it has been deleted, possibly because it didn't quite answer the question.

我发布另一个类似的问题,这个问题的答案帮助我也回答这个问题。你可以找到上述问题作出回答在这里:庆典:执行字符串命令

I posted another similar question, and the answer to that helped me also answer this question. You can find said question and answer here: bash: Execute a string as a command

这篇关于庆典:我怎样才能组装字符串:`"文件名= output_0.csv"`的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆