I am playing around with piping and grep tonight. I know that grep uses regex and that * means 0 or more occurrences of the preceding character. So the way I understand it is that if I do the following command, the entire directory should be listed... but nothing is listed. All that happens is the command line resets:
[root@LinuxAcademy etc]# ls /etc | sort | grep d* [root@LinuxAcademy etc]#
However, if I do the command again and replace d with p, the entire directory is listed just as I would expect:
[root@LinuxAcademy ~]# ls /etc | sort | grep p* ConsoleKit DIR_COLORS DIR_COLORS.256color DIR_COLORS.lightbgcolor NetworkManager X11 ...........<<rest of listing not pasted in>>
Even though no error was given when i used the grep d*, I redirected stderr to a file just to check and nothing was printed.
I then thought that grep may be interpreting the 'd' in 'grep d*' to be an option or command... but that doesn't seem to be the case either.
Can anyone help me understand what is going on and why when i use the command with
nothing is listed?