How to create UNIX / Linux commands?

I'm looking to create my own Unix / Linux commands using C programming. Let's say for example. I wrote a simple file copy program, I would like to make it as a Unix / Linux command.

How can I do it?

+4
source share
2 answers

Any executable file placed in a directory that is in the PATH (shell) variable will be a Unix command.

+6
source
  • Write your code using stdin , stdout and stderr to allow it to run from the command line and print its output
  • Parse the command line arguments and use them (if you need to)
  • Compile binary
  • Search in any directory in PATH (e.g. / usr / sbin)
+1
source

Source: https://habr.com/ru/post/1379971/


All Articles