当前位置: 动力学知识库 > 问答 > 编程问答 >

c - Minix 3: add new command

问题描述:

I'm currently trying to add a new command to Minix. I want to add a command named smile, which I want to display continuously a smiling face :-)the same way the command yes do with y.

I already created the smile dir in src/commands, with smile.c and Makefile, and added smile to src/commands/Makefile.

But after compiling I still get

# smile

smile: not found

Is there another file/header/script where I must add a reference to smile?

Thank you in advance!

网友答案:

You either need to specify the directory, or the directory must be part of the PATH environment variable.

Try

./smile

if the program is in the current directory.

or

export PATH=".:$PATH"
smile

to always check the current directory for commands during this bash session.

If the program is in a subdirectory (eg. src/commands/smile) relative to the current directory, you can add that to the path instead. Either explicitly,

src/commands/smile/smile

or by adding to the search path

export PATH="src/commands/smile:$PATH"
smile
网友答案:

placing your executable in the /usr/bin folder will allow the shell to recognize it. you should be able to type #smile now

分享给朋友:
您可能感兴趣的文章:
随机阅读: