Reputation: 3828
From a linux terminal the command:
ls application/js/{a*,b*,c*,d*,e.pocket-secure}
Will list all files in the application/js directory that start with a,b,c,d or e.pocket-secure.
If I place that command in doit.sh and execute:
sh doit.sh
I get:
ls: cannot access application/js/{a*,b*,c*,d*,e.pocket-secure*}: No such file or directory
I think the {} is confusing the shell interpreter, but I tried quoting (single|double) and also tried escaping the {} to no avail.
Upvotes: 0
Views: 98
Reputation: 4906
this syntax work only with bash interpretor you can try this
#/bin/bash
ls application/js/{a*,b*,c*,d*,e.pocket-secure}
and
chmod +x doit.sh
./doit.sh
OR
just type this on shell
bash doit.sh
Upvotes: 1
Reputation: 4856
When you type it in the terminal, I suspect that you are in bash
. When you run sh doit.sh
, you are changing the characteristics of the shell, either because bash
is in compatibility mode or because you are using something like dash
. Try doing bash doit.sh
.
Upvotes: 2