The scripts inside a shell script inherit access to STDIN when you call them, so if you have a shells script that only has cat
and you do ./script.sh < script.sh
then it’ll output the content of itself
In shell scripts if you do "$@"
it will actually expand “quoted sentences” correctly, and if you just do $@
it will always unwrap them into single words, I thought that if you did "$@"
it would combine all arguments into a single argument, and what it does is do what I thought $@
alone did.
I.e., with "$@"
the arguments "one two" three
will be 2 arguments, the first being "one two"
, and without it will become three arguments, all separated by space.