I have name file
- hua.txt
- hai.txt
if
print ls *{hua,las}* > taka.txt
in taka.txt return
ls hua.txt *las*
i want to *las*
not there,
i just want in taka.txt
ls hua.txt
and filter *{hua,las}*
must there... too
please help
I have name file
if
print ls *{hua,las}* > taka.txt
in taka.txt return
ls hua.txt *las*
i want to *las*
not there,
i just want in taka.txt
ls hua.txt
and filter *{hua,las}*
must there... too
please help
Many shells have different handles when a pathname expansion (glob) fails to match anything.
For example, in bash
you have two shell options:
nullglob
:
If a glob pattern fails to match anything, it is treated literally by default in bash
. You can disable this behavior to return an empty string by setting the nullglob
option beforehand:
shopt -s nullglob
failglob
:
This is more explicit, when a glob pattern fails to match anything bash
shows a relevant error message:
shopt -s failglob
Given your circumstances, you should go with nullglob
if you are using bash
, or look out for any similar option if you are using a different shell.
bash
andzsh
there isshopt -s nullglob
, but see this answer for an in-depth discussion. – Satō Katsura Oct 10 '16 at 04:54