I have a function hello, that is echoing i have put that function in .bash1 file then recalling the function with same user but with su command but it is not working.
username -> test
function -> below function save in .bash1
function hello() {
echo "Hello, $1!"
}
export -f hello
I run the below command from root
# su - test -c /home/test/.bash1 ; hello
Above command giving me error
-bash: hello: command not found
Note: What should i do that so my .bash1 function will run from root with su command, if it is not possible then what else the solution.