[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[NOT A] Re: Bug in 'ls'
From: |
David T-G |
Subject: |
[NOT A] Re: Bug in 'ls' |
Date: |
Thu, 30 Jan 2003 20:51:15 -0500 |
User-agent: |
Mutt/1.4i |
Todd --
...and then Todd Geders said...
%
% If you have a filename beginning with a "dash" such as '-test.png' and you
If you have a filename beginning with a "dash" then you have to work
around it, just like you have to work around an embedded space (try
cd /path/to/scratch/dir
touch "this is a test"
ls *test
and see) or any other "special" character.
% attempt to 'ls *.png' you get the following error:
%
% $ ls *.png
% ls: invalid option -- e
% Try `ls --help' for more information.
%
% $ ls | grep png
% -test.png
That will do it. When you specify "*.png" your shell expands that to
-test.png
(and would tack any other files on there if they were present). What ls
sees is
ls -test.png
which, of course, is the 'ls' command with the option flag '-t' and
the argument to that 'est.png' -- and the --help output clearly says
-t sort by modification time
without allowing for any other arguments.
%
% This is with GNU fileuitls version 4.1.11 on a GNU/Linux machine running
% Gentoo Linux 1.2 with gcc 2.95.3. Have not been able to test on other
% distribution. AFAIK, the only forbidden characters are / and NULL, so I
Well, not so much 'forbidden', but certainly less than wise.
% believe it is a bug.
Nope. An old trick on new users, in fact :-) Look for '--' in the docs.
For some fun, try
cd /
touch ./-rR
ls *
and figure out why your reverse-sorted listing goes on and on and on ;-)
%
% ~Todd Geders
HTH & HAND
:-D
--
David T-G * There is too much animal courage in
(play) address@hidden * society and not sufficient moral courage.
(work) address@hidden -- Mary Baker Eddy, "Science and Health"
http://justpickone.org/davidtg/ Shpx gur Pbzzhavpngvbaf Qrprapl Npg!
pgpCGUxgzWnMV.pgp
Description: PGP signature
- Bug in 'ls', Todd Geders, 2003/01/30
- [NOT A] Re: Bug in 'ls',
David T-G <=