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 trial

Development Tools Introduction to the Terminal Common Commands Other Things to Explore

karan Badhwar
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
karan Badhwar
Web Development Techdegree Graduate 18,135 Points

What 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
Steven Parker
229,732 Points

In 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
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
karan Badhwar
Web Development Techdegree Graduate 18,135 Points

Hey 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
Steven Parker
229,732 Points

The 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.