LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
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 18.04
Posts: 89

Original Poster
Rep: Reputation: 4
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



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

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 08:22 PM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration