Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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

karan Badhwar
seal-mask
.a{fill-rule:evenodd;}techdegree
karan Badhwar
Web Development Techdegree Student 15,246 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
217,407 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
karan Badhwar
Web Development Techdegree Student 15,246 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
217,407 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.