Is it different from C-shell? I remember in C-shell, when we do
echo *
then the *
is actually expanded by C-shell to all filenames in the current directory, so echo
really doesn't need to do anything but to echo what is passed into it. But in C-shell, we really need to do
find . -name '*item.js*'
so that even filenames such as list-item.jsx
will be matched any level down the directory. So it can't "expand" the *
of the current directory, because what if the current directory doesn't have such names.
However, in Bash, I found that we can just use
find . -name *item.js*
(it will go deep down into your folders). So doesn't that mean
- Bash doesn't expand the
*
into actual arguments before passing to a command, unlike C-shell? - Does that mean all commands running under Bash, such as
echo
has to take*
and process it inside of the code ofecho
? But then what if you invoke C-shell and runecho
-- then it is the same binary. Does that mean all commands must be able to handle*
when its binary sees the*
as the argument and must be able to handle it?
find
, we really should use single quotes:'*item.js*'
, because, otherwise it depends on whether the current folder has that pattern... and it feels kind of probabilistic... – nonopolarity Jul 08 '17 at 14:41