PDA

View Full Version : echo command



Lerner
09-14-2006, 09:07 AM
I tried
1) echo --help and
2) echo --version

but they doesn't seem to work. I am using version 5.0.3 of knoppix

malaire
09-14-2006, 10:16 AM
I tried
1) echo --help and
2) echo --version

but they doesn't seem to work. I am using version 5.0.3 of knoppix

(I'm using Knoppix 4.0.2, but this is likely same in your Knoppix also)

The "problem" is that there are 2 different versions of "echo":
1. The one provided internally by bash-shell
2. The one located at /bin/echo

First one is used by default when you just use echo on bash command-line, and is documented at man bash-builtins. This one doesn't support --help or --version.

The second one is documented at man echo and does support --help and --version.



knoppix@0[knoppix]$ echo --version
--version
knoppix@0[knoppix]$ /bin/echo --version
echo (GNU coreutils) 5.2.1
Written by FIXME unknown.

Copyright (C) 2004 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


There are also few other differences, like support for hexadecimal escapes:


knoppix@1[knoppix]$ echo -e "\x41\x42\x43"
ABC
knoppix@1[knoppix]$ /bin/echo -e "\x41\x42\x43"
\x41\x42\x43

Lerner
09-14-2006, 10:47 AM
Thanks

There are also few other differences, like support for hexadecimal escapes:


knoppix@1[knoppix]$ echo -e "\x41\x42\x43"
ABC
knoppix@1[knoppix]$ /bin/echo -e "\x41\x42\x43"
\x41\x42\x43


In both the above cases output was ABC.

malaire
09-14-2006, 12:32 PM
Thanks

There are also few other differences, like support for hexadecimal escapes:


knoppix@1[knoppix]$ echo -e "\x41\x42\x43"
ABC
knoppix@1[knoppix]$ /bin/echo -e "\x41\x42\x43"
\x41\x42\x43


In both the above cases output was ABC.

You might have newer version of /bin/echo than I do, which supports this.

maxIT
09-15-2006, 08:58 PM
For a complete list of bash-built-in-commands just type 'help'.
To get a help page about a built-in-bash-command type 'help command', in this case 'help echo'.