If I have a program written in C, how can I run this program in a terminal with just a single word (the program's name), no matter where it is on the system?
Asked
Active
Viewed 157 times
0
-
6Add the path to the program to $PATH. – Pilot6 Aug 03 '16 at 14:13
-
1What you really want is to have the location of your program added to `$PATH` variable, as Pilot6 properly said. See this http://askubuntu.com/q/60218/295286 – Sergiy Kolodyazhnyy Aug 03 '16 at 14:36
1 Answers
0
See this:
http://www.linfo.org/path_env_var.html
As Pilot6 and Serg wrote in comment, You have to expand your $PATH system variable and compile program in release mode. When you will have this done, you will call myProgram and your system should check if it exists ind $PATH directories; it will eventually run it if it exists, or show error "unknown command" if it doesn't.
Szczepan
- 268
- 2
- 13