Processes and Bash

# current process id 
echo $$
#!/bin/bash

echo $$
# script execution
./script.sh

# script execution in the parent shell
. ./script.sh
source ./script.sh
# shell script creation with the cat command
cat > f << END
#!/bin/bash
echo $$
END

chmod +x f
./f
cat f

# script correction
cat > f << END
#!/bin/bash
echo \$\$
END

chmod +x f
cat f
./f