I started to learn Bash scripting and I'm using Bash scripting tutorial
There it says
Before Bash interprets (or runs) every line of our script it first checks to see if any variable names are present. For every variable it has identified, it replaces the variable name with its value. Then it runs that line of code and begins the process again on the next line.
So does Bash first run through the whole script to find variables? I'm not sure whether this is what the author tried to say but if yes I guess it is not correct?
when I execute:
#!/bin/bash echo "hello $USERR" USERR=John
I get hello
as result.
If I run:
#!/bin/bash USERR=John echo "hello $USERR"
then i get hello John
as result.
--
, and not checking for failure of commands...). Security implications of forgetting to quote a variable in bash/POSIX shells