Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

parameters of echo

0 views
Skip to first unread message

Parmenides

unread,
Jan 3, 2009, 8:46:29 PM1/3/09
to
Hi,

The following script, with input of a character *, will print two
line on the screen. The first echo has one parameter, while the second
echo has two parameters. But, why the result is so difference?

Chris F.A. Johnson

unread,
Jan 3, 2009, 9:25:03 PM1/3/09
to

"The decision on these matters depends on this: either it is or
it is not." -- Parmenides of Elea (c. 475 B.C.)

Since you have posted no script, there can be no decision.

--
Chris F.A. Johnson, author <http://cfaj.freeshell.org/shell/>
Shell Scripting Recipes: A Problem-Solution Approach (2005, Apress)
===== My code in this post, if any, assumes the POSIX locale
===== and is released under the GNU General Public Licence

Maxwell Lol

unread,
Jan 4, 2009, 7:27:53 AM1/4/09
to
Parmenides <mobile.p...@gmail.com> writes:

As Chris says, you haven;t provided a script.

But you should know that if you type
echo *,

then the shell will expand "*," to the list of filenames in the current
directory, and then pass these filenames to echo.

The results will vary when you change directories.

Allodoxaphobia

unread,
Jan 4, 2009, 1:05:08 PM1/4/09
to
On Sun, 04 Jan 2009 07:27:53 -0500, Maxwell Lol wrote:
>
> But you should know that if you type
> echo *,
>
> then the shell will expand "*," to the list of filenames in the current
> directory, and then pass these filenames to echo.

Really??? /bin/bash :

[jonesy@nix2 tmp]$ echo *,
*,
[jonesy@nix2 tmp]$ echo *
fileahXbHN filexfxuSP gconfd-jonesy jpsock.150_06.20575 kde-jonesy
ksocket-jonesy mcop-jonesy pdf.log ssh-koQFEm5411
[jonesy@nix2 tmp]$

Jonesy
--
Marvin L Jones | jonz | W3DHJ | linux
38.24N 104.55W | @ config.com | Jonesy | OS/2
* Killfiling google & XXXXbanter.com: jonz.net/ng.htm

Stephane CHAZELAS

unread,
Jan 4, 2009, 1:25:09 PM1/4/09
to
2009-01-4, 18:05(+00), Allodoxaphobia:

> On Sun, 04 Jan 2009 07:27:53 -0500, Maxwell Lol wrote:
>>
>> But you should know that if you type
>> echo *,
>>
>> then the shell will expand "*," to the list of filenames in the current
>> directory, and then pass these filenames to echo.
>
> Really??? /bin/bash :
>
> [jonesy@nix2 tmp]$ echo *,
> *,
[...]

There appears not to be any file in your current directory whose
name ends in "," (or maybe all the ones that end with "," also
begin with ".". At least with csh, tcsh or zsh, you'd have had
an error message.

--
Stéphane

Sven Mascheck

unread,
Jan 4, 2009, 6:18:46 PM1/4/09
to
Maxwell Lol wrote:
> Parmenides writes:

>> The following script, with input of a character *, will print [...]

> But you should know that if you type
> echo *,
>

> then the shell will expand "*," [...]

Houston, we have a problem
(quoting, ortography, probably both :)

What's the above called, middle clause, parenthesis(?)
to comma or not to comma...

Allodoxaphobia

unread,
Jan 4, 2009, 10:47:34 PM1/4/09
to

Ahhh!

[jonesy@nix2 ~]$ touch 'test,'
[jonesy@nix2 ~]$ echo *,
test,
[jonesy@nix2 ~]$ \rm 'test,'
[jonesy@nix2 ~]$ echo *,
*,
[jonesy@nix2 ~]$

Hopefully this isn't the _only_ thing I learn this year! :-)

0 new messages