Abhik Bhattacharjee Asked: 2018-11-08 09:28:07 +0800 CST2018-11-08 09:28:07 +0800 CST 2018-11-08 09:28:07 +0800 CST Why isn't shell expanding the braces in the shell script? [duplicate] 772 I am trying the following script for listing the archived files in my current directory. #!bin/sh for file in *.{zip,jar} do echo $file done which gives the output: *.{zip,jar} Why isn't shell expanding the braces? scripts bash 1 Answers Voted Best Answer sudodus 2018-11-08T09:47:26+08:002018-11-08T09:47:26+08:00 The following shellscript works for me #!/bin/bash for file in *.{png,jpg}; do echo $file; done This brace expansion works in bash, but not in sh #!bin/sh lacks a slash, should be #!/bin/sh to work correctly
The following shellscript works for me
This brace expansion works in
bash
, but not insh
#!bin/sh
lacks a slash, should be#!/bin/sh
to work correctly