Is there any way to call a shell script and use the functions/variable defined in the script from python?
The script is unix_shell.sh
#!/bin/bash
fun
I do not know to much about python, but if You use export -f foo
after the shell script function definition, then if You start a sub bash, the function could be called. Without export
, You need to run the shell script as . script.sh
inside the sub bash started in python, but it will run everything in it and will define all the functions and all variables.