Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to enable globstar in Bash 4

Tags:

bash

bash4

shopt

I put the following unsuccessfully to my .bashrc

shopt -s globstar

I am trying to test the command in action by

ls **/*.c

and by comparing it to

ls */*/*.c

How can you enable globstar in Bash 4?

like image 433
Léo Léopold Hertz 준영 Avatar asked Apr 27 '09 14:04

Léo Léopold Hertz 준영


1 Answers

Hmm. shopt -s globstar should work.

To debug, make sure you are running Bash 4:

$SHELL --version

Then check the setting of globstar:

shopt globstar

If it is unset, try setting it manually:

shopt -s globstar

Now see if that works. If it does, you might want to look into why your .bashrc isn't working. Did you remember to restart you shell after editing your .bashrc, or load it with . .bashrc?

like image 161
Brian Campbell Avatar answered Oct 24 '22 11:10

Brian Campbell