Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
can any one tell me how does bash help in executing the command echo and kill.how does the shell checks whether the command is builtin command or not. plz tell the complete procedure for both commands.
Without inspecting the bash source code it's hard to know but it probably has a list of its own built-ins and, when it is given a command to execute without a path (without a leading ~, ./ or /) it consults that list.
Bash shell forks a child process in order to execute any command including 'echo' or 'kill' whatever.
The child process i.e. 'echo' or 'kill' whatever dies automatically when it completes its execution !
I see u are posting all your assignment questions one by one for us to solve ?????????
AIUI built-ins do not require fork exec and that is one of the reasons for having built-ins such as echo when perfectly good external commands like /bin/echo already exist. From the link (my emphasis) "A builtin is a command contained within the Bash tool set, literally built in. This is either for performance reasons -- builtins execute faster than external commands, which usually require forking off [1] a separate process"
If these are homework questions (and they could well be) they are unusual ones or strangely re-cast.
sir actually i m not posting all my assignment here. we were given an assignmment on working of shell. its our intrest to know extra in this field
Thanks for the confirmation
I thought as much. Your questions go beyond homework (they would be unfairly hard questions for homework when first learning bash). Nice that you are curious and want to fully understand
Several of your questions relate (indirectly) to *n*x processes. Your curiosity and hunger for deeper understanding would be rewarded by learning about processes. Here are some links. Best to start with the first because it explains processes as seen from the shell that you are already learning about.
AIUI built-ins do not require fork exec and that is one of the reasons for having built-ins such as echo when perfectly good external commands like /bin/echo already exist. From the link (my emphasis) "A builtin is a command contained within the Bash tool set, literally built in. This is either for performance reasons -- builtins execute faster than external commands, which usually require forking off [1] a separate process"
thanks for the enlightenment !
Of course, what will be the use of builtin commands if shell still had to fork a process for them ! They are there for the speed !
Of course, what will be the use of builtin commands if shell still had to fork a process for them ! They are there for the speed !
True -- and some of them because they would not work as external commands, the cd built-in for example. Can you figure out why an external cd command would not work (it's process-related)?
True -- and some of them because they would not work as external commands, the cd built-in for example. Can you figure out why an external cd command would not work (it's process-related)?
cd cannot work as an external command because an external command creates a child process, and a process cannot affect the environment of its parent (shell in this case).
Last edited by Aquarius_Girl; 12-14-2009 at 05:50 AM.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.