Bash和C ++,朋友们? [英] Bash and C++, friends?

查看:85
本文介绍了Bash和C ++,朋友们?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我打算编写一个程序,通过

shell(bash)以交互方式输入输入。我还希望能够编写一个shell脚本来执行与我的程序相关的各种命令

。总之,我想使用bash中的一些(或所有)功能为

a程序提供输入。


它的主要是格式这个文件我遇到了麻烦。我想要

能够写出这样的东西:

#!/ bin / bash

$ x $ b for x in xs < br $> b $ b do

myprog.method(x)

完成


如何从一个调用myprog bash脚本(myprog正在执行并对

输入做出反应)?


希望我能够传达我的信息。


提前致谢!


-

(此处应插入幽默引语)

Hi, I''m planning on writing a program that interactively is fed input via a
shell (bash). I also want to be able to write a shell script that executes
various commands related to my program. In short i want to provide input to
a program using some (or all) of the functionality found in bash.

It''s mainly the format of the file I''m having trouble with. I wanted to be
able to write something like this:
#!/bin/bash

for x in xs
do
myprog.method(x)
done

How do i call myprog from a bash script (myprog is executing and reacting to
the input)?

Hopefully I''ve been able to convey my message.

Thanks in advance!

--
(Should insert humorous quotation here)

推荐答案

Magnus Jonneryd写道:
Magnus Jonneryd wrote:
我打算编写一个程序,通过shell(bash)以交互方式输入输入。我还希望能够编写一个shell脚本来执行与我的程序相关的各种命令。总之,我希望
使用bash中的一些(或全部)功能为程序提供输入。

它主要是文件的格式我我遇到了麻烦。我希望
能够写出这样的东西:
#!/ bin / bash

xs

myprog.method( x)


如何从bash脚本调用myprog(myprog正在执行并对输入作出反应)?
Hi, I''m planning on writing a program that interactively is fed input
via a shell (bash). I also want to be able to write a shell script
that executes various commands related to my program. In short i want
to provide input to a program using some (or all) of the
functionality found in bash.

It''s mainly the format of the file I''m having trouble with. I wanted
to be able to write something like this:
#!/bin/bash

for x in xs
do
myprog.method(x)
done

How do i call myprog from a bash script (myprog is executing and
reacting to the input)?



我认为您需要查看(a)如何将参数传递给您的

程序,并查看主要函数的参数和(b)

查看一些原始表达式解析。


我推测应该可以编写一个脚本来调用

你的程序类似于


do

myprog" method"



I think you need to look at (a) how arguments are passed to your
programs and for that see the arguments to ''main'' function and (b)
look at some primitive expression parsing.

I speculate that it should be possible to write a script to call
your program similarly to

do
myprog "method"


x

完成


其中方法将指示要调用的方法和
x
done

in which "method" will indicate which method to call and


x将

扩展为可以在内部转换为值的内容

传递给方法(功能)。


V
x will
expand into something that can be internally converted into values
to pass to that method (function).

V


这篇关于Bash和C ++,朋友们?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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