Tiny Core Linux
Tiny Core Base => TCB Q&A Forum => Topic started by: vishrut_n_shah on February 17, 2011, 06:27:33 AM
-
Hello ,
I want to know that which file contains defination for internal commands like ls,cat,rm,mkdir ???
Can i make my own commands that will be run just like internal shell commands ??
Please reply...
Thanks in advance .. :)
-
Hi vishrut_n_shah
Open a terminal and type busybox for a list of commands. You can make your own
commands by writing a script.
-
Yes i found all the commands...
But when i opened file it shows some stars and boxes...
Exactly where to i write script for my own command?? :)
Thanks
-
ls -l `which <command>`
shows the path of an external command.
Internal shell commands are compiled into the shell at build time.
Shell scripts rely on calling existing commands.
HTH
-
Hi vishrut_n_shah
Busybox is a compiled program, not a script, you cannot edit it. You could create a
directory under your home directory for scripts and then add it to your path.
-
Hi rich ,
Ok. I understand that.But Is there any way so that i can build my commands and they will be comipled at compile time like internal commands.
I think there is a defination or code behind every internal commands.Am i right? if yes then i want to just refer that code.Is ther any way to get it??
Thanks
-
Hi vishrut_n_shah
I'm not sure of what you are trying to do. Is there any special command you are looking
for? Can you give a specific example of what you would like to do? Unless you know
how to write programs in C, scripting is really the right way to go. The calc command
in /usr/bin for example is a script.
-
Hi Rich ,
I am just trying to embed my command to the list so that i can complete my project. And i know the programing in C infect i am an IT Engineer...
For example if i have written my own find command to find some specific file from the entire directory. then how i will make it executable just as like ls .
Do you understand my problem??
Please reply .. If it requires C programming i can handle that one very smoothly.
Thanks in advance
-
Hi rich ,
Ok. I understand that.But Is there any way so that i can build my commands and they will be comipled at compile time like internal commands.
I think there is a defination or code behind every internal commands.Am i right? if yes then i want to just refer that code.Is ther any way to get it??
Thanks
The source code of busybox
-
Hello tinypoodle,
So i have to make changes in source code of Busybox ??
Thanks
-
Hi vishrut_n_shah
Now we are getting somewhere. If you write your own find command for example,
just place it in the /usr/local/bin directory and the operating system will use your
find command instead of it's own. If you write your command in C then you can use
the compiletc application to compile it, if you write a script file then you just
chmod 755 yourfilename to make it executable.
-
Hello tinypoodle,
So i have to make changes in source code of Busybox ??
Thanks
That would be if you want to modify internal commands of the shell yes, as the default shell in TC is ash, which is part of busybox.
http://www.busybox.net/FAQ.html might help you understand much better
-
Thanks a lot Rich & Tinypoodle.... I'll do it.. Thanks
-
First of all Thanks for your help....
I tried it and working fine. .
But it's a temporary... actually i have TinyCore in Flash drive.. so i have to make it at every time ???
Is there any way to make it permanent ?
Thanks
-
Hello ,
Please help me to make it permanent ?? ???
Thanks
-
Hi vishrut_n_shah
Open the file /opt/filetool.lst. Add a line for each command you want to save.
For example:
usr/local/bin/command1
usr/local/bin/command2
etc....
When you shut down and backup your files will be saved, when you restart they will be restored.
-
A better option is to create /home/tc/.local/bin and put all your personal scripts/binaries there.
mkdir -p /home/tc/.local/bin
Then you won't have to keep adding new commands to /opt/.filetool.lst
-
In that case you might also want to suggest that he add PATH=/home/tc/.local/bin:$PATH
to his /opt/bootlocal.sh file.
-
bootlocal.sh cannot directly change a logins environment.
The users .profile already adds ~/.local/bin to PATH.
-
In that case you might also want to suggest that he add PATH=/home/tc/.local/bin:$PATH
to his /opt/bootlocal.sh file.
grep -A 2 local /etc/skel/.profile
;)