简体   繁体   English

创建命令并通过linux终端执行它们

[英]Creating commands and executing them through linux terminal

I participate in competitive programming contests like codechef. 我参加诸如Codechef之类的竞争性编程比赛。 So they take input in a specific format. 因此,它们以特定格式进行输入。 I am looking to develop a tester in C++. 我正在寻找用C ++开发测试仪。 Some things I plan to do are: 我打算做的一些事情是:

  • give the format of input in a file format.txt. 以文件format.txt给出输入格式。
  • give sample input test cases whose output is know. 给出输出已知的样本输入测试用例。
  • test the program on the test cases(ii) and generate output in separate file. 在测试用例(ii)上测试程序,并在单独的文件中生成输出。
  • test the program randomly on several test cases in accordance with the format specified in format.txt and generate output in separate file. 根据format.txt中指定的格式在几个测试用例上随机测试程序,并在单独的文件中生成输出。

After having done all this, I want a command to represent all the above operations. 完成所有这些操作后,我想要一个命令来代表以上所有操作。 How do I introduce a new command( for example test_codechef sample_program.cpp where new command executes my tester on sample_program.txt) in the linux terminal? 如何在Linux终端中引入一个新命令(例如test_codechef sample_program.cpp ,其中新命令在sample_program.txt上执行我的测试器)?

I think you want to add a command to Terminal and use it , if you're talking about Bash then just create a file without a type example for bash file : 我认为您想向Terminal添加一个命令并使用它,如果您谈论的是Bash,则只需创建一个不带bash文件类型示例的文件:

#!/bin/bash 
echo "Hello World "

save: HelloWorld 保存:HelloWorld

after: 后:

chmod +x HelloWorld
cp HelloWorld /usr/bin/

then type on Terminal : HelloWorld , and the result Hello World , so if I'm going correct you need to learn some stuff about Bash Linux 然后在Terminal上输入: HelloWorld ,然后输入Hello World,所以如果我要正确的话,您需要学习一些有关Bash Linux的知识

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 使用QT Creator在树莓派上通过Wifi执行简单的终端命令 - Executing simple terminal commands through Wifi on raspberry pi using QT creator 使用Qt在linux终端上编写命令 - Writing commands on linux terminal using Qt 代码块停止使用 gnome-terminal (linux) 执行 - Codeblocks stop executing with gnome-terminal (linux) linux mint 终端不执行 Qt 创建者给出的命令 - linux mint terminal does not execute commands given from Qt creator 在 C++ 中执行终端命令,arguments 在执行时使用 C++ 文件从终端传递 - Execute terminal commands in C++ with arguments passed from terminal with C++ file when executing it 通过linux终端将数据发送到另一个进程的stdin - Sending data to stdin of another process through linux terminal Visual Studio 2019 C++ 项目中的特殊字符并使用它们执行 CMD 命令 - Special characters in Visual Studio 2019 C++ project AND executing CMD commands with them 使用 linux 终端上的 system() 将用户输入的命令发送到 c++ 中的 arduino - Sending user inputted commands to an arduino in c++ using system() on a linux terminal 使用execvp()执行shell命令 - Executing shell commands with execvp() 通过终端执行程序时如何使用用户输入程序? - How do you take user inputer upon executing your program through terminal?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM