How the kernel does things
Simplified (bit), there are two ways that the kernel in a POSIX system knows how to execute a program. One, if the program is in binary format, which the kernel understands (for example, ELF ), the kernel can execute it "directly" (in more detail from the field). If the program is a text file starting with shebang, for example
what-have-you, ββ , ββ :
/usr/bin/somebinary -arg "$0"
$0 script, . (, , # - , shebang .)
PATH env
PATH, , , , python script , python, ,
env, , POSIX, , python PATH. ,
script , PATH.
BASH, SH Invocation
, . , /bin/sh , ββ /bin/bash. bash POSIXLY_STRICT sh, /bin/sh, , plain-old-bash.
MySQL arg
shebang , , mysql - , mysql script.
use mydb;
select * from mytbl;
, ββ mysql "$0". .my.cnf, mysql "$ 0" . :
use mydb;
select * from mytbl;
, "$ 0" ( ).
, mysql script . sql mysql:
mysql < my_sql_commands