LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This 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


Reply
  Search this Thread
Old 12-01-2009, 03:23 AM   #1
mohit_parihar
LQ Newbie
 
Registered: Nov 2009
Posts: 28

Rep: Reputation: 15
source code


can any body tell me where can i found the source code for echo command. so that i can download it such that it can help me for further studies on echo command
 
Old 12-01-2009, 03:36 AM   #2
gnufreex
LQ Newbie
 
Registered: Oct 2009
Distribution: Ubuntu
Posts: 21

Rep: Reputation: 17
The echo command have two pieces. One is in Linux kernel, other one in shell. So that is where you should be looking.
 
1 members found this post helpful.
Old 12-01-2009, 07:03 AM   #3
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
Quote:
Originally Posted by gnufreex View Post
The echo command have two pieces. One is in Linux kernel, other one in shell. So that is where you should be looking.
How does this relate to finding the source code???!!! You seem to be saying that to find the source code, one should look in the kernel or the shell. Please explain.

@mohit*;

A Google search shows first that "echo" is both a BASH built-in, and is also a separate command (/bin/bash). I don't know how they differ.

I found the source code for BASH here:
http://ftp.gnu.org/gnu/bash/

Some more time with Google will find the source for /bin/echo.

Google is your friend.......
 
Old 12-01-2009, 07:52 AM   #4
i92guboj
Gentoo support team
 
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 4,083

Rep: Reputation: 405Reputation: 405Reputation: 405Reputation: 405Reputation: 405
Either a shell builtin or part of coreutils. It depends on what you are using. So, you either need the sources for your shell or the sources for coreutils.
 
Old 12-02-2009, 05:34 AM   #5
gnufreex
LQ Newbie
 
Registered: Oct 2009
Distribution: Ubuntu
Posts: 21

Rep: Reputation: 17
Type

which echo

to find out what instance do you use.

@pixellany

If it is built in kernel, than he need to downloade source code of kernel and look there. If it is shell, than your link will do.

Last edited by gnufreex; 12-02-2009 at 05:36 AM.
 
Old 12-02-2009, 06:42 AM   #6
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
Quote:
Originally Posted by gnufreex View Post
Type

which echo

to find out what instance do you use.
If I do this, it comes up with /bin/echo. If I then disable /bin/echo, echo still works. I believe that the built-in gets run by default.

Quote:
@pixellany

If it is built in kernel, than he need to downloade source code of kernel and look there. If it is shell, than your link will do.
echo is not built into the kernel. It is built into bash (one option), and also exists as a standalone utility. (My issue with your other post is that you did not answer the question of where to get the source code.)
 
Old 12-02-2009, 06:44 AM   #7
i92guboj
Gentoo support team
 
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 4,083

Rep: Reputation: 405Reputation: 405Reputation: 405Reputation: 405Reputation: 405
Quote:
Originally Posted by pixellany View Post
If I do this, it comes up with /bin/echo. If I then disable /bin/echo, echo still works. I believe that the built-in gets run by default.
It does. That why the output of "which" is irrelevant if you want to find what are you running. For that you use

Code:
type echo
Which in your case will output:

Code:
echo is a shell builtin
 
Old 12-02-2009, 07:05 AM   #8
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
Quote:
Which in your case will output:

Code:

echo is a shell builtin
Yup!!
 
Old 12-02-2009, 10:55 AM   #9
gnufreex
LQ Newbie
 
Registered: Oct 2009
Distribution: Ubuntu
Posts: 21

Rep: Reputation: 17
Quote:
Originally Posted by pixellany View Post
echo is not built into the kernel. It is built into bash (one option), and also exists as a standalone utility. (My issue with your other post is that you did not answer the question of where to get the source code.)
I did not provided a link to source because I thought he just asks for hint where to look, or what word to type in google. Sorry for not being clear.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] make use of gcc source code to parse c++ source file famsinyi Programming 14 10-19-2009 06:47 PM
[SOLVED] why I couldn't find the source code of printf function in glibc source? famsinyi Programming 5 09-21-2009 09:06 AM
LXer: Voip Encryption, source code open source LXer Syndicated Linux News 0 07-09-2006 03:21 PM
How to convert Assembly code to "C" source code ssg14j Programming 2 08-01-2005 12:48 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 08:42 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration