+ 3
How do I write new Linux commands that support options?
How do I write new programs which shall run on Linux command line the same ways as the existing commands do, and which also can be used with the switches/options as ls-l,etc do?
7 Respostas
+ 12
Linux has a very rich command line language, and commands can be put in a file and executed, like a .bat file in Windows. To start, you create a plain text file and put your commands in it. You then make your file executable.
For instance, if your file name is "my_file", execute this command to make it executable:
chmod 755 my_file
To run it, execute this command:
./my_file
If you are just getting started with Linux commands, enter "linux command line introduction" in your favorite search engine.
+ 11
N00B, you should be able to put the script together the same way, and then just run it through the GUI just like any other executable (double click). Hope this helps. 🤙
+ 9
I see what you're sayin' Hardik Khane. But I think N00B is lookin' for a simpler, more hands on, 'tactile' approach. Blueprints v construction...to make an analogy. Please correct me if I'm wrong.
+ 3
Charlie Mitchell But I want to run the script without putting "./" in front of my script.
+ 1
Charlie Mitchell I'll try tomorrow, thank you.
+ 1
Adding the directory in which the executable is saved, to the PATH variable enables us to enter the command without ./ . But the problem of implementing the switches/options still remains.
+ 1
Charlie Mitchell, I agree😀