LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Wildcards and Mint (noob problems) (https://www.linuxquestions.org/questions/linux-newbie-8/wildcards-and-mint-noob-problems-863391/)

neveser 02-17-2011 03:45 PM

Wildcards and Mint (noob problems)
 
I am trying to use wildcards with the ls command in mint, but it doesn't like them...

When I try 'ls f??g' I get the error
'ls: cannot access f??G: No such file or directory'

I can use the * wildcard, it seems to work fine. The ? wildcard doesn't work at all.

Is there something I should know about mint and its use of wildcards?

I know, I know, total noob question!

sysslack 02-17-2011 04:29 PM

Hallo neveser
I am afraid your problem does not relate to mint. It relates to how reg expression works.
What you will match is a file name that must start with f and must be four characters long and must end with G.
You can easily test this by creating three files with the touch command,
ex :
touch fraG
touch fsgG
touch fjkkG

the 2 first files should match ls -l f??G
but not the last

neveser 02-17-2011 05:44 PM

OK.
I created a file called frag.
Now, if I want to list all files that are 4 letters that begin with f and end with g, what is the exact syntax for that?
I'm trying 'ls f??g' and it returns an error.

EDIT:
It seems as though neither of the wildcards work. I don't understand this at all.
I have a few png files on my system and when I type 'ls *.png' I get the error 'ls: cannot access *.png: No such file or directory'

sysslack 02-20-2011 03:30 AM

For me it works. Witch shell do you have?
I have bash!
bash-3.2$ bash --versionbash --version
GNU bash, version 3.2.17(1)-release
Here is a link of reg exp
http://www.regular-expressions.info/

good luck

EricTRA 02-20-2011 03:49 AM

Hello,

In my version of Bash (GNU bash, version 4.1.5(1)-release (x86_64-pc-linux-gnu)) it also works. Can you run the following command and post output here?
Code:

shopt -p | grep glob
to check if globbing options are activated in your shell. Also confirm if you're using bash or not.

Kind regards,

Eric

sysslack 02-24-2011 03:55 PM

Sure!
Here is my output:

Code:

bash-3.2# shopt -p | grep glob
shopt -u dotglob
shopt -u extglob
shopt -u failglob
shopt -u nocaseglob
shopt -u nullglob



All times are GMT -5. The time now is 02:42 AM.