I hope this question is okay. Basically what I want to do is create a small program that, using the Ubuntu terminal, I could just call it and execute a command from any directory. For an easy example, something like print Hello World
would simply print Hello World
back out.
Any advice on how I could do this?
#include <iostream>
int main(int argc, char* argv[])
{
for (char letter : arv) {
std::cout << letter;
}
}
I think something like that would work, just a really simple program, but how could I get it to install a command that I could use anywhere?
I hope this makes sense, if I should elaborate on something, please let me know.
To explain why this is not a duplicate, I will elaborate a bit to say that I'm not asking how to call a command from the program. It has been partially answered that I can move my executable file to the /usr/bin/
directory, which was helpful, however I am more-so curious on how I can do it so that if a user downloads and uses my program, they won't have to move the file to /usr/bin/
, they can just download and have their global command.