linux - Set a Bash function on the environment -
I need to define the Bash function in the Bash environment with the C / C ++ program I shellshock Before the bug, I can define a function like this: or equivalent to C program: or But using a Bash version with shellshock , I can not manage to define my actions in the environment. The strange thing is that if I run thanks advance If you type And then you do not need to play the game with the internal bad interface to define the function. (If the script is running, then the function is also required to export, for whatever reason, after the code It has the advantage of working with both patch and unread bases. (I have to make patch similar to several programs, so I share your pain.)
my_func = '() {echo "this is my work";}'
setenv ("my_func", "() {echo" This is my work ";)", 1);
putenv ("my_func = () {echo" This is my work ";););
env , then I can define my work in the environment, but if I call it, then Bash says that it does not exist.
bash Starting with code> execv> > (so that you are only implementing it once), you can (use
execl for clarification):
execl ("/ bin / bash", "Bash", "file_to_run", "arg1", "arg2", 0);
execl ("/ bin / bash", "bash", "-c", "f () {...} With () {...} \ n. $ 0 "," file_to_run "," arg1 "," arg2 ", 0);
-c in the logic,
export -f & lt; func & gt; ; Add line.)
Comments
Post a Comment