Reputation: 2053
I've a executable named say "sortx". Now I want to write a C program which transforms this executable into a shell command.
ex: ./sortx numbers.txt
After running the C program on "sortx" what I want is :
sortx numbers.txt
Upvotes: 3
Views: 332
Reputation: 639
Add the directory in which sortx is present to $PATH. This way you could execute your program locally, like,
sortx numbers.txt
To add directory ~/my_bin to the beginning of the $PATH environment variable, add or update this in your .bash_profile:
PATH=~/my_bin:$PATH
Upvotes: 6
Reputation: 118470
Upvotes: 1
Reputation: 1579
On Linux to make any script or program globally executable (e.g "sortx" rather than "./sortx") you can put the script in wither /usr/bin or /bin -- I prefer /usr/bin :)
Upvotes: 3