终端中设置的globstar不传播到脚本 [英] globstar set in terminal not propagating to script

查看:40
本文介绍了终端中设置的globstar不传播到脚本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要使用源提供的build.sh构建一个库.它包含一个globstar路径( src/**/*.java ).我使用 shopt -s globstar 启用了globstar,并且所有功能都可以从终端上运行,但可以从bash文件中进行:

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

我收到以下错误:

ls: cannot access **/*.java: No such file or directory

推荐答案

只需放置

shopt -s globstar

也进入脚本.

这篇关于终端中设置的globstar不传播到脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆