bash shell如何加载c程序

sh/bash/dash/ksh/zsh等Shell脚本
回复
lysddp
帖子: 59
注册时间: 2008-01-04 22:21

bash shell如何加载c程序

#1

帖子 lysddp » 2011-05-05 16:37

想在bash shell加载一个c程序(比如当前目录下的test.cpp),并且运行这个c++程序50次,请问在bash shell要怎么写。
头像
lilydjwg
论坛版主
帖子: 4249
注册时间: 2009-04-11 23:46
系统: Arch Linux
联系:

Re: bash shell如何加载c程序

#2

帖子 lilydjwg » 2011-05-05 17:31

[bash]
#!/bin/bash

g++ -o test test.cpp || exit $?
for i in {1..50}; do
./test
done
[/bash]
lysddp
帖子: 59
注册时间: 2008-01-04 22:21

Re: bash shell如何加载c程序

#3

帖子 lysddp » 2011-05-05 20:15

解决了,谢谢2楼的兄弟了 :em01
回复