How can I edit a command?
Some commands (or most), as far as I know are stored inside files within the bin folder. My question is how can I edit such commands? For example, if I want to change what cd does, how can I do that?
Obviously, I don't want to change those basic commands, but I want to change custom commands that might be installed by me. |
Get the source, edit the source, compile the source and install it (preferably with a different name -- when you get updates for your system, they'll overwrite existing files).
The source may already be on your distribution media (Slackware is) or you'll need to find it at your distribution web site. Hope this helps some. |
I wouldn't recommend changing the original commands. You could create your own commands. This can be done in 2 ways:
a) Create an alias in ~/.bashrc eg. Code:
alias elisp='cd /home/sycamorex/data/projects/programming/lisp ; emacs -nw' b) create a directory ~/bin and add it to your path by adding "export PATH=$PATH:~/bin" to ~/.bashrc After that create shell scripts in ~/bin For example, a program that lists all my aliases: Code:
#!/bin/bash chmod +x ~/bin/name_of_the_file |
Quote:
|
Quote:
|
Hi there,
Quote:
Quote:
For simple tasks, script languages like Perl or PHP may be sufficient; these programs aren't compiled (i.e. translated into machine code), but instead remain human-readable, and the so-called interpreter translates them on-the-fly each time they're executed. What's really suitable for you depends very much on what you want to achieve, and what programming skills and experience you already have. [X] Doc CPU |
Quote:
|
Quote:
Depending on a distribution, the sources might already be installed on the system. If not, it's easy to install them. |
Quote:
|
Hi there,
Quote:
Besides, yes, it is possible to reverse-engineer the machine code and reconstruct the source to a certain extent. But you have no identifiers (symbols, variable or function names) because they're left behind during compilation. You have no comments that tell you how a few lines of code are supposed to work. So that hard work isn't worth the effort, unless you're talking about closed-source software and you have a very strong motivation to disclose how it works. [X] Doc CPU |
Which distro are you using and what programs are we talking about?
If these are not open-source programs then you've got a problem:) |
Quote:
If you're trying to reverse-engineer a proprietary package, well, that's different (and you're on your own for that one -- don't be naughty). The key phrase is "free and open source;" that literally means you can get the source for anything that is free and open source, just go look for it (Google is your fiend here). You've obviously got internet access: Want the source code for VirtualBox -- go download it; what the source for LibreOffice -- go download it; want the source for cd -- go download it. Hope this helps some. |
Quote:
|
I believe cd is a shell built-in command, rather than a programme with its own source code.
|
Quote:
In fact, it's impossible to create a separate program that changes the current directory of the shell, since each process (including the shell and command) has its own separate current directory. |
All times are GMT -5. The time now is 06:16 AM. |