WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: Where is the defination of internal commands ?  (Read 4470 times)

Offline vishrut_n_shah

  • Newbie
  • *
  • Posts: 26
Where is the defination of internal commands ?
« 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 ..  :)
There is never a wrong time to do right things !!

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11573
Re: Where is the defination of internal commands ?
« Reply #1 on: February 17, 2011, 06:35:54 AM »
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.
« Last Edit: February 17, 2011, 06:39:34 AM by Rich »

Offline vishrut_n_shah

  • Newbie
  • *
  • Posts: 26
Re: Where is the defination of internal commands ?
« Reply #2 on: February 17, 2011, 07:38:31 AM »
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
There is never a wrong time to do right things !!

Offline tinypoodle

  • Hero Member
  • *****
  • Posts: 3857
Re: Where is the defination of internal commands ?
« Reply #3 on: February 17, 2011, 07:42:05 AM »
Code: [Select]
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
"Software gets slower faster than hardware gets faster." Niklaus Wirth - A Plea for Lean Software (1995)

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11573
Re: Where is the defination of internal commands ?
« Reply #4 on: February 17, 2011, 07:44:07 AM »
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.

Offline vishrut_n_shah

  • Newbie
  • *
  • Posts: 26
Re: Where is the defination of internal commands ?
« Reply #5 on: February 17, 2011, 08:03:42 AM »
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
There is never a wrong time to do right things !!

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11573
Re: Where is the defination of internal commands ?
« Reply #6 on: February 17, 2011, 08:34:15 AM »
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.

Offline vishrut_n_shah

  • Newbie
  • *
  • Posts: 26
Re: Where is the defination of internal commands ?
« Reply #7 on: February 17, 2011, 09:03:15 AM »
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
There is never a wrong time to do right things !!

Offline tinypoodle

  • Hero Member
  • *****
  • Posts: 3857
Re: Where is the defination of internal commands ?
« Reply #8 on: February 17, 2011, 09:07:51 AM »
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
"Software gets slower faster than hardware gets faster." Niklaus Wirth - A Plea for Lean Software (1995)

Offline vishrut_n_shah

  • Newbie
  • *
  • Posts: 26
Re: Where is the defination of internal commands ?
« Reply #9 on: February 17, 2011, 09:19:22 AM »
Hello tinypoodle,

                         So i have to make changes in source code of Busybox ??
Thanks
There is never a wrong time to do right things !!

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11573
Re: Where is the defination of internal commands ?
« Reply #10 on: February 17, 2011, 09:31:52 AM »
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.

Offline tinypoodle

  • Hero Member
  • *****
  • Posts: 3857
Re: Where is the defination of internal commands ?
« Reply #11 on: February 17, 2011, 09:34:10 AM »
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
"Software gets slower faster than hardware gets faster." Niklaus Wirth - A Plea for Lean Software (1995)

Offline vishrut_n_shah

  • Newbie
  • *
  • Posts: 26
Re: Where is the defination of internal commands ?
« Reply #12 on: February 17, 2011, 09:34:35 AM »
Thanks a lot Rich & Tinypoodle.... I'll do it.. Thanks
There is never a wrong time to do right things !!

Offline vishrut_n_shah

  • Newbie
  • *
  • Posts: 26
Re: Where is the defination of internal commands ?
« Reply #13 on: February 17, 2011, 10:22:29 AM »
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
There is never a wrong time to do right things !!

Offline vishrut_n_shah

  • Newbie
  • *
  • Posts: 26
Re: Where is the defination of internal commands ?
« Reply #14 on: February 17, 2011, 10:48:03 AM »
Hello ,

       Please help me to make it permanent ??  ???

Thanks
There is never a wrong time to do right things !!