LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   more information about echo command (https://www.linuxquestions.org/questions/linux-newbie-8/more-information-about-echo-command-719264/)

shuchi 04-15-2009 06:11 AM

more information about echo command
 
can anyone tell me how does echo command work internally?
can echo command used for purpose other then display message, colour and effects?

pixellany 04-15-2009 06:19 AM

What is the context of this question?

First, look at the man page ("man echo"). I doubt if the command does anything more than what it says there......;)

As for the internals, you may need to look at the source code. Quick Google says echo is a built-in, so you'll need the BASH source code.

colucix 04-15-2009 06:25 AM

echo is also an external command coming from coreutils. The code is derived from the bash source code. Maybe the coreutils' one is more readable, being in a stand-alone C file.

shuchi 04-16-2009 05:21 AM

ofcourse echo can do other things as i said can change the colour of foreground and background and also can set some effetcs, echo can create a file.
and now i wannna know can echo display the access time of a file, if yes then how?

Tinkster 04-16-2009 05:27 AM

Quote:

Originally Posted by shuchi (Post 3510808)
ofcourse echo can do other things as i said can change the colour of foreground and background and also can set some effetcs,

Ummm ... nope, that's the terminal. Echo just tells it
to do so.

Quote:

Originally Posted by shuchi (Post 3510808)
echo can create a file.

Nope - that's the shell.

Quote:

Originally Posted by shuchi (Post 3510808)
and now i wannna know can echo display the access time of a file, if yes then how?

No.


Cheers,
Tink

shuchi 04-16-2009 08:56 AM

echo with wc
 
when i type the following command
echo *|wc
the output will be- 1 25 55
here i know what is 25(no of files in current directory), but what are 1 and 55 for?




plz tell me if anyone knows..........
waiting for reply...
thankyou!

pwc101 04-16-2009 09:18 AM

Quote:

Originally Posted by shuchi (Post 3510998)
when i type the following command
echo *|wc
the output will be- 1 25 55
here i know what is 25(no of files in current directory), but what are 1 and 55 for?




plz tell me if anyone knows..........
waiting for reply...
thankyou!

Please read the first line of the wc man page. It is there, as clear as day.

colucix 04-16-2009 11:08 AM

First look at the output echo *, then try to figure out what those numbers mean after having read the man page as suggested by pwc101. This is a general advice: carefully read the man pages! Most of the answers are there.

shuchi 04-17-2009 10:34 PM

echo wid $
 
thankyou for ur useful suggestion.
now following are some combinations with echo and their outputs, i jst tried randomly, plz tell me what the output are abt........

1. # echo $-
himBH

2. #echo $!
2983
(this is not a PID)

3. #echo $&
[1]20662
[root@localhost~]#$
date;pwd
sat apr.............. 2009
[1]+Done echo $
/root


let me know what's d significance of $ sign?




Quote:

Originally Posted by colucix (Post 3511140)
First look at the output echo *, then try to figure out what those numbers mean after having read the man page as suggested by pwc101. This is a general advice: carefully read the man pages! Most of the answers are there.


colucix 04-18-2009 06:15 AM

You can find all the answers here. You should really read a shell programming guide, where you can find all the proper answers to your basic questions. Have a nice time!


All times are GMT -5. The time now is 04:43 PM.