简体   繁体   中英

How to use cat command with ignore conditions in bash script?

The following command works fine on the command line, but not in a bash script.

cat dir/!(00|01)/* > all.txt

When executing the same command in a bash script I get the following error:

../scripts/preprocess.sh: line 8: syntax error near unexpected token `('
../scripts/preprocess.sh: line 8: `    cat dir/!(00|01)/* > all.txt'

Does anyone know how to get this to work in a script?

Thanks

您需要在命令行中设置的脚本中设置相同的shell选项,即extglob

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM