There are a few similar questions around that I've already seen, but I've come up with something different.
I'm reading this http://www.tldp.org/LDP/abs/html/invoking.html and I got confused when I read:
"Not recommended is using
sh scriptname
, since this effectively disables reading from stdin within the script."
There are two things here: first, I tried to execute a script like
sh myscript.sh < file.txt
and it reads from stdin fine.
The second thing is that I understand that adding shebang at the top of the script
#!/bin/bash
means exactly the same as
bash myscript.sh
, so I don't get what the author is pointing out there. I just got confused.
Anyon that understands what's the author's point?
Thanks so much in advance.
sh < scriptname
that's the problem.