how to create script inside a script Bash: Scriptception,
#!/bin/bash
cat > scriptMaster.sh << ENDMASTER
cat > script1.sh << EOF
#your code
EOF
cat > script2.sh << EOF
#your code
EOF
bash script1.sh # run script1
bash script2.sh # run script2
ENDMASTER