+ 2
how to create CLI programs?
how do i create a built-in CLI programs like ls, cd and wget to access automatically from the terminal?
5 Answers
+ 8
shell programs are written in shell script for unix based systems (linux, mac osx) and batch scripts for windows. itâs a process that is a little detailed to fully explain on a post, but to summarize, you would write the script and save it somewhere on your system to a .sh or .bat file respectively. then, you would add the file path of the script or the directory its in to your systemâs PATH variable. Hereâs an interesting article for doing so on unix based systems: https://link.medium.com/gVZHsED6kbb
Programs do not have to be written in shell script or batch. You can write a script in almost any programming language, including python and java, and it can be turned into a commands. They just have to be added to the systems PATH variable.
+ 9
This is different for various Operating Systems. For Windows the easiest way is to create the executable and then copy or move it into the same directory as the other CLI executables (location of which escapes me at the moment, but should easy enough to find) or place it in a directory location you desire and add its file path to the systems or users %path% environment variable.
For Unix systems it is similar but you will need to edit the bash_profile to add the path. Google will be your friend here.
+ 2
thx for the helpful guides guys, i'll research further from here