From: Seebs on
On 2010-05-14, moonhkt <moonhkt(a)gmail.com> wrote:
> Thank try OK. But how printf works ?

Have you tried to read any documentation? Have you experimented? Have
you made ANY effort at all before posting to Usenet?

> How printf list of current
> directory ?

It doesn't. It just prints its arguments.

-s
--
Copyright 2010, all wrongs reversed. Peter Seebach / usenet-nospam(a)seebs.net
http://www.seebs.net/log/ <-- lawsuits, religion, and funny pictures
http://en.wikipedia.org/wiki/Fair_Game_(Scientology) <-- get educated!
From: Stephane CHAZELAS on
2010-05-14, 02:15(+00), Chris F.A. Johnson:
[...]
> There is no reason to use ls without any options. (Someone will
> probably come up with a case, but generally ls isn't necessary
> unless you are using at least one option.)
[...]

Unless the list of arguments is a list of directories for ls to
list the content of.

--
Stéphane
From: moonhkt on
On 5月14日, 上午10時11分, Seebs <usenet-nos...(a)seebs.net> wrote:
> On 2010-05-14, moonhkt <moon...(a)gmail.com> wrote:
>
> > Thank try OK. But how printf works ?
>
> Have you tried to read any documentation?  Have you experimented?  Have
> you made ANY effort at all before posting to Usenet?
>
> > How printf list of current
> > directory ?
>
> It doesn't.  It just prints its arguments.
>
> -s
> --
> Copyright 2010, all wrongs reversed.  Peter Seebach / usenet-nos...(a)seebs.nethttp://www.seebs.net/log/<-- lawsuits, religion, and funny pictureshttp://en.wikipedia.org/wiki/Fair_Game_(Scientology) <-- get educated!

My first help on man page.
From: Guillaume Dargaud on
You could pipe it through grep:
$ ls -1 | egrep "moonhkt(\.[0-9]{8,8})?$"
moonhkt
moonhkt.20100405
moonhkt.20100406

Make a small function
$ function lsb { ls -1 | egrep "$1(\.[0-9]{8,8})?$"; }
$ lsb moonhkt.ksh
moonhkt.ksh
moonhkt.ksh.20100406
--
Guillaume Dargaud
http://www.gdargaud.net/

From: Chris F.A. Johnson on
On 2010-05-14, Stephane CHAZELAS wrote:
> 2010-05-14, 02:15(+00), Chris F.A. Johnson:
> [...]
>> There is no reason to use ls without any options. (Someone will
>> probably come up with a case, but generally ls isn't necessary
>> unless you are using at least one option.)
> [...]
>
> Unless the list of arguments is a list of directories for ls to
> list the content of.

True, but in many cases I would use:

printf "%s\n" dir1/* dir2/* ...


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