Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

globstar set in terminal not propagating to script

Tags:

bash

shell

shopt

I need to build a library with the build.sh provided with the source. It contains a globstar path (src/**/*.java). I enabled globstar with shopt -s globstar and all works great from terminal but from bash file:

#!/bin/bash
ls **/*.java

I get the following error:

ls: cannot access **/*.java: No such file or directory
like image 970
chaosfoal Avatar asked Feb 17 '23 07:02

chaosfoal


1 Answers

Just put

shopt -s globstar

into the script as well.

like image 192
choroba Avatar answered Feb 27 '23 00:02

choroba