让我的Mac上一个C发射 [英] Make a C launcher on my Mac
问题描述
我想为一个C程序我做了一个发射器,我希望它在终端中运行。我会怎么做呢?我甚至不具备丝毫的想法
I want to make a launcher for a c program I made and I want it to run in terminal. How would I do this? I don't even have the slightest idea
推荐答案
只要创建一个文本文件,将其保存到桌面作为例如 my_C_program.command
(注意 .command
后缀),然后在文本文件,你可以把你喜欢的任何终端命令,如:
Just create a text file, save it to the Desktop as e.g. my_C_program.command
(note the .command
suffix), then in the text file you can put whatever terminal commands you like, e.g.
# run my_C_program
my_C_program arg1 arg2
请注意:保存后的 .command
文件,你需要确保它是可执行的:
Note: after saving the .command
file you need to make sure it is executable:
$ chmod +x ~/Desktop/my_C_program.command
这会给你一个名为 my_C_program
的运行 my_C_program
通过命令行的桌面上双击点击图标。 (这是假设 my_C_program
是在某处你的 PATH
)。
This will give you a double-clickable icon on the desktop called my_C_program
that runs my_C_program
via the command line. (This assumes my_C_program
is somewhere in your PATH
).
这篇关于让我的Mac上一个C发射的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!