Re:Show HN: Command Line Challenge
by coherentpony on Thursday January 26, 2017 @01:51PM
(#13494097)
wasn't accepted. Am I wrong or is it wrong?
[ Parent
| on HN ]
Only filenames matching access.log should be returned.
Unfortunately, since shopt globstar is disabled I ended up needing to do this:
grep 500 $(find . -type f -iname "access.log*")
Re:Show HN: Command Line Challenge
by JoshTriplett on Thursday January 26, 2017 @02:25PM
(#13494415)
You could also include "shopt -s globstar; " at the beginning of your line.
grep -r 500 --include access.log
That returns the filenames in the format "./access.log" but it wanted "access.log". It's a bug.
I used echo -e 'access.log\naccess.log.1\nREADME'. :D
Re:Show HN: Command Line Challenge
by coherentpony on Thursday January 26, 2017 @10:39PM
(#13497535)
Gotcha. Thanks.
Hahahaha I did the exact same thing
You are: grep matches strings, not integers.
grep -rl '500'
works just fine.There is no concept of an integer on an argument vector. Quoting in bash just escapes IFS characters (usually whitespace) to control whether to include them in a given argument on the vector, but these arguments (as passed to exec) are always character strings (with or without quoting).