[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: kfdialog.h



On Thu, 8 May 1997, Rick Jones wrote:

> panther# cd ../kdm*
> panther# pwd
> /usr/src/kde/kdm-0.4.4
> panther# find /usr -iname kfdial*
> /usr/src/kde/kdm-0.4.4/kgreeter/kfdialog.cpp
> /usr/src/kde/kdm-0.4.4/kfdialog.cpp

try putting quotes around kfdial*.

e.g.
	find /usr -iname "kfdial*"

Without the quotes, the kfdial* argument MATCHES the file kfdialog.cpp
in the current directory (/usr/src/kde/kdm-0.4.4), and that is what is
passed to find as an argument.

You're even taking advantage of this behaviour when you issue commands
like "cd ../kdm*"


> [...deleted...]
> 
> Now why can't "find" see the kfdialog.h/.moc files from the kdm directory
> but it sees them from kdelibs directory?
> 
> I am not happy about this.  Does anybody have a clue?

it's not a problem with find, it's a problem with the user :-)

if you don't put quotes around wildcard characters (like "*" and "?")
then your shell will attempt to expand the wildcard BEFORE passing the
arguments to the program.  If any files in the current directory match the
wildcard then they get passed as arguments, otherwise the wildcard itself
is passed.

e.g. if you execute the command "foo *.c" there are two possible sets of
arguments passed to program foo:

1. in a directory with NO .c files, foo gets "*.c"
2. in a directory with fred.c, joe.c, etc.c, foo gets "fred.c joe.c etc.c"

correct quoting and escaping of characters with ", ', and \ is very
important in any shell, and also in many scripting languages like
sed, awk, perl, and others. it is definitely a good use of any unix
user/admin's time to learn how it works.

a quick summary:

    use \ to escape a single character.  e.g.  \*, \?

    use " to quote an entire string, allowing $ substitution.
          e.g. "s/$SEARCH/$REPLACE/"

    use ' to quote an entire string.  e.g 's/  */ /g'

you can use combinations of the above too.  e.g. you can include a quote
within a quoted string like so: '\'hello\'' is 'hello'


I don't know if it's still in print, but a good basic book for
explaining how the shell works is "The UNIX System" by S.R. Bourne
(the same Steve Bourne for whom bash is named). Published 1983 by
Addison-Wesley.

Similar information can be found in the various Unix FAQs, and probably
in some of the Linux Doc Project stuff.

IMO, the best way of learning this stuff is to play with it
interactively.

craig


--
TO UNSUBSCRIBE FROM THIS MAILING LIST: e-mail the word "unsubscribe" to
debian-user-request@lists.debian.org . 
Trouble?  e-mail to templin@bucknell.edu .


Reply to: