Results 1 to 2 of 2
I am just getting started with Linux (SUSE) and have what seems like a strange result. When applying a wildcard back in the ancient days when I did some Unix ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 10-11-2011 #1
- Join Date
- Oct 2011
- STL, USA
Unexpected ls wildcard results? Am I crazy?
I am just getting started with Linux (SUSE) and have what seems like a strange result. When applying a wildcard back in the ancient days when I did some Unix (or even DOS) I'm sure that a wildcarded directory request only produced a _subset_ of what was in the specified directory. Right? Am I crazy? Why is it that the results I get for ls a* doesn't list the items in the current directory that begin with 'a' but also lists the CONTENTS of those directories? Is this normal or do I have some goofy recursive user option messing with me? Thanks!
- 10-11-2011 #2
So the way that wildcard expansion works, the shell expands the wildcard, and passes the results to the program. The default behaviour of ls when given a directory on the commandline, is to expand that directory.
This is the "ls" output of my test directory:
alex@niamh:~/test$ ls bash c c++ java ruby
alex@niamh:~/test$ ls c* c: a.out ckpt_file map_file popen_bash.c read_to_noread_mem.c type_sizes.c bitfields.c file ncurses read_efault.c shmem.c userid.c c++: a.out count.cpp
alex@niamh:~/test$ ls -d c* c c++