LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 11-06-2019, 10:23 AM   #1
captain_john
LQ Newbie
 
Registered: Nov 2019
Posts: 3

Rep: Reputation: Disabled
Problem with Globbing


I created 2 files:
Code:
touch Test.txt test.txt
I can list the files:

Code:
ls -l
-rw------- 1 user users 20 Nov 6 test.txt
-rw------- 1 user users 20 Nov 6 Test.txt
However, globbing doesn't seem to work:

Code:
ls -l [a-z]*
-rw------- 1 user users 20 Nov 6 test.txt
-rw------- 1 user users 20 Nov 6 Test.txt
...but, using the macro, it works:

Code:
ls -l [[:lower:]]*
-rw------- 1 user users 20 Nov 6 test.txt

Thoughts?
 
Old 11-06-2019, 12:33 PM   #2
pan64
LQ Guru
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 13,603

Rep: Reputation: 4361Reputation: 4361Reputation: 4361Reputation: 4361Reputation: 4361Reputation: 4361Reputation: 4361Reputation: 4361Reputation: 4361Reputation: 4361Reputation: 4361
Code:
user@host:/tmp/a$ touch Test.txt test.txt
user@host:/tmp/a$ ls -l
total 0
-rw-r--r-- 1 user group 0 Nov  6 18:31 test.txt
-rw-r--r-- 1 user group 0 Nov  6 18:31 Test.txt
user@host:/tmp/a$ ls -l [a-z]*
-rw-r--r-- 1 user group 0 Nov  6 18:31 test.txt
user@host:/tmp/a$ ls -l [[:lower:]]*
-rw-r--r-- 1 user group 0 Nov  6 18:31 test.txt
user@host:/tmp/a$
this works for me as expected
what kind of shell/os is it?
additionally would be nice to post not only parts of the result, but the full commands as I did it.

Last edited by pan64; 11-06-2019 at 12:35 PM.
 
Old 11-06-2019, 12:46 PM   #3
captain_john
LQ Newbie
 
Registered: Nov 2019
Posts: 3

Original Poster
Rep: Reputation: Disabled
Bash 4.2 on both Ubuntu 18.04 and CentOS
 
Old 11-06-2019, 01:16 PM   #4
pan64
LQ Guru
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 13,603

Rep: Reputation: 4361Reputation: 4361Reputation: 4361Reputation: 4361Reputation: 4361Reputation: 4361Reputation: 4361Reputation: 4361Reputation: 4361Reputation: 4361Reputation: 4361
this is related to shopt nocaseglob and the variable LANG. see for example here: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=37971
 
1 members found this post helpful.
Old 11-06-2019, 01:59 PM   #5
captain_john
LQ Newbie
 
Registered: Nov 2019
Posts: 3

Original Poster
Rep: Reputation: Disabled
Yep! unset LANG results in desired behavior. Good catch!
 
  


Reply


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
LXer: Bash Extended Globbing LXer Syndicated Linux News 0 10-09-2008 12:10 PM
LXer: Fancy Globbing With Zsh On Linux and Unix LXer Syndicated Linux News 0 07-22-2008 01:20 AM
Globbing using Korn Shell metallica1973 Programming 1 12-05-2007 05:56 PM
Globbing Problem in BASH Hink Programming 2 07-28-2005 01:19 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

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

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration