Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialkaran Badhwar
Web Development Techdegree Graduate 18,135 PointsWhat does he mean by this?
Note that a wildcard expression must be surrounded by quotes, or the shell will attempt to expand it and it will never reach the find command.?
2 Answers
Steven Parker
231,248 PointsIn the video, he demonstrates this using this example:
ā ā find -name "*.txt"
...which passes the argument *.txt
to the "find" command.
But if he had left off the quotes, like this:
ā ā find -name *.txt
...then the shell would have expanded the wildcard and passed the 4 arguments statue.txt cart.txt pigeon.txt sparrow.txt
to the "find" command instead, which would have caused a command syntax error.
karan Badhwar
Web Development Techdegree Graduate 18,135 PointsThankyou Steven Parker, I got it
karan Badhwar
Web Development Techdegree Graduate 18,135 Pointskaran Badhwar
Web Development Techdegree Graduate 18,135 PointsHey Steven Parker, thankyou for the assist and wonderful explanation. I have one more question, so how shell breaks down the command and arguments , doesn't it start with the command (find) and then understands the arguments, but over here it breaks down the argument first not go with the command. I am sorry if I am being confusing..
Steven Parker
231,248 PointsSteven Parker
231,248 PointsThe shell parses the entire line, expanding things that are not quoted by substituting wildcards and parameters, and then invokes the command and passes the resulting arguments to it.
For more details, see this Gnu Document on Shell Expansions.