I am trying to completely understand a Cygwin alias command that is in .bash_profile. It works just fine. But, I need to understand it so that I can use it in other alias commands or perhaps in other command lines in general. The command is:
alias lf="ls -l | egrep -v '^d'"
I understand all of the command except the ^d that is included here. I know how to use alias, basic Unix commands, piping, ls, egrep and other general cases. I also understand the process of substitution. I just don’t understand the ^d itself.
More than just explaining that particular construct, it would really help if you could refer me to a site that explains the general usage of it. Google and I don’t seem to see eye-to-eye regarding my searches regarding it.
Also, can you tell me if there is some way to “echo” a command like this so that you can see it as it is processed? It would help me diagnose such a question in the future.
Thanks…RG
ls -l output starts from d for directories
‘^d’ is a regular expression that matches symbol ‘d’ at the beginning of the line
-v switch tells egrep to exclude lines matching regular expression
Thus we filter out ‘ls -l’ output to exclude directories