bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#8513: stat list file name


From: Bob Proulx
Subject: bug#8513: stat list file name
Date: Sat, 16 Apr 2011 23:51:10 -0600
User-agent: Mutt/1.5.21 (2010-09-15)

- - wrote:
> here a small bug in stat:
> 
> stat -c %n *
> stat : option invalide -- 's'
> Saisissez « stat --help » pour plus d'informations.
> 
> ls
> address@hidden&.txt
> 
> stat is not able to list a direstory if a file start with a -

Thank you for your bug report but this is not a bug in stat but a
misunderstanding of how file globs operate with your command shell.

The '*' on your command line is expanded by the shell to all of the
files in the directory.  You have a filename that starts with a dash.
The resulting command line is the same as if you had placed the dash
on the command line yourself.

You can see this by using 'echo' to print out the command.

  $ echo stat -c %n *
  echo stat -c %n address@hidden&.txt

As you can see by using echo there is no difference between having a
file starting with a dash and placing an option with a dash on the
command line.  The only way to tell is for you to invoke the command
without the ambiguity.  Either use ./* to avoid having filenames start
with a dash or use "--" to signal to the command that there are no
further options.

Either:

  $ stat -c %n ./*

Or:

  $ stat -c %n -- *

Bob





reply via email to

[Prev in Thread] Current Thread [Next in Thread]