GNU bug report logs -
#12551
ls -l
Previous Next
Reported by: "Chen,Wei" <weichen <at> mdanderson.org>
Date: Mon, 1 Oct 2012 15:35:01 UTC
Severity: normal
Tags: moreinfo
Done: Assaf Gordon <assafgordon <at> gmail.com>
Bug is archived. No further changes may be made.
Full log
Message #10 received at control <at> debbugs.gnu.org (full text, mbox):
tag 12551 + moreinfo
thanks
Chen,Wei wrote:
> When I typed 'ls -l *chr4*' in linux, it gave me this:
>
> bash-4.1$ ls -l *chr4*
> ls: invalid option -- '4'
> Try `ls --help' for more information.
>
> It used to work for me, why?
You are expanding a file glob "*chr4*" in the current directory. This
will be expanded to match any files in the current directory. If any
of those files start with a dash character '-' then the string will be
interpreted as an option.
You can see the problem by using echo to print the file glob.
echo ls -l *chr4*
To avoid it you will need to force an end of option argument
processing or force the string to not start with a dash.
ls -l -- *chr4*
ls -l ./*chr4*
Please see this FAQ and the next two related ones after it too.
http://www.gnu.org/software/coreutils/faq/#How-do-I-remove-files-that-start-with-a-dash_003f
Bob
This bug report was last modified 6 years and 268 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.