I have a simple bash script for file listing:
$ cat process.sh
for i in *; do echo $i; done
$
and then I run:
$ ./process.sh
a
b
c
d
process.sh
$
and
$ . ./process.sh
$
and
$ for i in *; do echo $i; done
$
I've read Why does Bash behave differently when called as sh
? which explains that inline commands use sh
instead of bash
- is wildcard non-POSIX in this case?
- Why do I get different behaviours when executing the same code?
- How to make this example work?
- Are there any other cases to look out for?