Results 1 to 2 of 2
Any ideas as to why the CMD: " ls file[1-13] " ??
only lists " file1, file3 " but won't list " file2 or file13 "
What would be the ...
- 01-27-2011 #1Just Joined!
- Join Date
- Jan 2011
- Posts
- 4
ls [brackets] question
Any ideas as to why the CMD: "ls file[1-13]" ??
only lists "file1, file3" but won't list "file2 or file13"
What would be the correct syntax using brackets and hyphen to list all four files if you have:
file1
file2
file3
file13
??
Thanks for your help.
- 01-27-2011 #2
Characters inside square brackets are treated as pure characters, not numbers. So [1-9] would match any of those nine digits, but ["13"] just means "either a 1 or a 3". So file2 does not display under these conditions.
Using braces rather than brackets allows more variation. So for example ls file{1,2,3,10} would display file1, file2, file3 and file10. But I don't think you can use a range in this type of syntax."I'm just a little old lady; don't try to dazzle me with jargon!"


Reply With Quote