No, that's not how it works with grep. The shell is expanding the glob * to all the things in the current directory that don't start with a dot and that's what grep sees. It then reads each of them in turn or if they're a directory it descends into them recursively; the * plays no further part in the descent.
Command line tools for the novice
21–30 of 59 posts
Re: Command line tools for the novice
#22Earlier quoted context omitted.
Interesting. I'll give it a go. I've tried living in iPython and eshell, and while I prefer python or lisp as a programming language to almost anything, neither is nearly as quick and dirty as sh for doing stuff with stdin/out from a pipeline of tools. I don't quite know what a better language than sh would look like, but a man can dream. Also, universe, if you're going to get on fixing the sh problem, can we restruc…
Please define "argument expansion".
'ls *.jpg'
is passed expanded to 'ls 1.jpg 2.jpg 3.jpg' BEFORE ls is run. This choice means that if a program wants to use another style of regular expression (ie: pcre), it must be enclosed in quotes on the shell, ie: "ls | grep -P '.*jpg'"Re: Command line tools for the novice
#23I'd love to hear other tools that you guys are using for your daily workflow.
Re: Command line tools for the novice
#24Grey text on grey background: http://contrastrebellion.com/
W3C: http://www.w3.org/TR/UNDERSTANDING-WCAG20/visual-audio-contr...
Re: Command line tools for the novice
#25Earlier quoted context omitted.
This was a good list for the intermediate command line user looking to customize. For the absolute newbie I'd reduce it down to git/hg, ssh, grep/ack and curl. For crazy power users, I'm a huge fan of vim+tmux+zsh combo as described in http://www.drbunsen.org/text-triumvirate.html
That's a good list. I considered including Git but that could be an entire article by itself. I've looked at TMux but I just don't I'd use it.
Re: Command line tools for the novice
#26Earlier quoted context omitted.
Please define "argument expansion".
In many (all?) unix shells, globs are expanded by the shell before being passed to the program. 'ls *.jpg' is passed expanded to 'ls 1.jpg 2.jpg 3.jpg' BEFORE ls is run. This choice means that if a program wants to use another style of regular expression (ie: pcre), it must be enclosed in quotes on the shell, ie: "ls | grep -P '.*jpg'"
Re: Command line tools for the novice
#27Earlier quoted context omitted.
Please define "argument expansion".
In many (all?) unix shells, globs are expanded by the shell before being passed to the program. 'ls *.jpg' is passed expanded to 'ls 1.jpg 2.jpg 3.jpg' BEFORE ls is run. This choice means that if a program wants to use another style of regular expression (ie: pcre), it must be enclosed in quotes on the shell, ie: "ls | grep -P '.*jpg'"
Re: Command line tools for the novice
#28> In Grep grep -R 'some term' * , in Ack ack 'some term'. The -R tells grep to search through all directories and subdirectories while the * tells it what types of files. No, that's not how it works with grep. The shell is expanding the glob * to all the things in the current directory that don't start with a dot and that's what grep sees. It then reads each of them in turn or if they're a directory it descends into…
Re: Command line tools for the novice
#29> In Grep grep -R 'some term' * , in Ack ack 'some term'. The -R tells grep to search through all directories and subdirectories while the * tells it what types of files. No, that's not how it works with grep. The shell is expanding the glob * to all the things in the current directory that don't start with a dot and that's what grep sees. It then reads each of them in turn or if they're a directory it descends into…
I was under the impression that * expanded to all things not starting with a dot in all directories-- or better: in each directory that -R dictates. I understand that "* tells it what types of files," isn't correct, but I don't understand what you mean by "plays no further part in the descent."
$ mkdir x
$ cd x
$ echo aa > .y
$ mkdir y
$ echo aa > y/z
$ echo aa > y/.z
$ grep -r a *
y/.z:aa
y/z:aa
Notice that hidden files in the top-level (.y) don't show up, but those in subdirectories (y/.z) do.It's kind of a gotcha. Fortunately one rarely finds dotfiles in subdirs.
Re: Command line tools for the novice
#30Earlier quoted context omitted.
I was under the impression that * expanded to all things not starting with a dot in all directories-- or better: in each directory that -R dictates. I understand that "* tells it what types of files," isn't correct, but I don't understand what you mean by "plays no further part in the descent."
$ mkdir x $ cd x $ echo aa > .y $ mkdir y $ echo aa > y/z $ echo aa > y/.z $ grep -r a * y/.z:aa y/z:aa Notice that hidden files in the top-level (.y) don't show up, but those in subdirectories (y/.z) do. It's kind of a gotcha. Fortunately one rarely finds dotfiles in subdirs.