LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 03-07-2011, 04:18 AM   #16
joham34
Member
 
Registered: Oct 2009
Location: Greece
Distribution: ubuntu 14.04
Posts: 75

Original Poster
Rep: Reputation: 3
Question


Thanks again for your detailed reply
I have made clear in my mind that bash intervenes only to do the globbing and that if no globbing is required, it passes the arguments to locate.


Bash compares strings with unquoted pattern matching characters against the names of files in the current working directory. As David the H. correctly pointed out, Bash also obeys any relative paths you specify like ./subdir/ or ../otherdir/ when matching the pattern.

Code:
~/foo$ mkdir bar
~/foo$ touch bar/one bar/two bar/three
~/foo$ ls bar
one  three  two
~/foo$ echo bar/*e*
bar/one bar/three




I presume this is what should happen and indeed, when giving e.g
Code:
ioannis@ioannis-laptop:~/Music$ locate *th* | wc -l
17
I get the expected result

I can't really say because I don't know your system. My best guess is that no files in your current working directory match the pattern, so locate receives the argument *te*.

No , it cant be the case because I didnt change anything .Something really strange ins going on .I tried to add dir kate in my home dir to see if your assumption is right and.. :

Code:
ioannis@ioannis-laptop:~$ mkdir kate
ioannis@ioannis-laptop:~$ sudo updatedb
ioannis@ioannis-laptop:~$ locate *te* | wc -l
391
ioannis@ioannis-laptop:~$ rm -r kate
ioannis@ioannis-laptop:~$ sudo updatedb
ioannis@ioannis-laptop:~$ locate *te* | wc -l
29
29 again ! hurahh ! and before removing kate 391 !

And only about the half belong to my home dir :

Code:
ioannis@ioannis-laptop:~$ locate *te* | tail -2
/usr/share/librarian/Templates/C
/usr/share/librarian/Templates/C/scrollkeeper_cl.xml

I suppose it is also conceivable that your system is configured somewhat differently with regards to locate and/or shell options. I can't even guess what those differences might be. In such a case you will have to review the appropriate documentation and configuration files with great intensity to discover the cause. I very much doubt this is the case though.[/QUOTE]

I have a clean installation of Ubuntu 10.10 64 bit and have touched nothing related to configurations of bash .

I suspect that a bug is whats going on here

Last edited by joham34; 03-07-2011 at 11:10 AM.
 
Click here to see the post LQ members have rated as the most helpful post in this thread.
  


Reply

Tags
expansion, pattern, quoting, shell, wildcard


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Yet Another Bash Quotes Within Quotes Issue tboyer Linux - Software 17 11-03-2012 11:17 AM
Problems with quotes and double quotes Andruha Slackware 6 01-02-2010 04:44 PM
Using single quotes vs double quotes in PHP strings vharishankar Programming 6 07-11-2005 11:41 AM
how to determine cpu usage, memory usage, I/O usage by a particular user logged on li rags2k Programming 4 08-21-2004 04:45 AM
In BASH shell, what is the difference in usage between single and double quotes? davidas Linux - Newbie 2 04-05-2004 03:00 AM


All times are GMT -5. The time now is 09:00 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration