[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#12551: ls -l
From: |
Bob Proulx |
Subject: |
bug#12551: ls -l |
Date: |
Mon, 1 Oct 2012 10:49:08 -0600 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
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