When doing:
#!/bin/bash
function01() {
echo "Func01"
}
function02() {
echo "Func02"
}
function03() {
echo "Func03"
}
clear
function01
function02
#sudo su
function03
and calling as:
curl http://192.168.1.1:80/myScript.sh | sudo bash
or
curl http://192.168.1.1:80/myScript.sh | bash
It run ok but if uncommenting the line:
#sudo su
above then it throw the error:
bash: line 1: function03: command not found