run-shell . , , run-shell, / tmux.
script
, script . , update_gitbar, . , , , , , . ~/bin, , PROMPT_COMMAND be "$HOME/bin/update_gitbar; $PROMPT_COMMAND".
, – , bash - , ( "ShellShock"; : , , ), , .
tmux
- , , tmux, . tmux script, , :
export -f update_gitbar
tmux
, , , update_gitbar PROMPT_COMMAND. , tmux update_gitbar , – script. , (, tmux), , .
, , - tmux setenv VAR=value .tmux.conf. Bash " ", .
bash - "ShellShock", , () , , , (b) , , .
, , update_gitbar :
env | sed -n '/^[^=]*update_gitbar/,/^}/p' |
perl -ne 'chomp; $a .= $a? "; $_" : $_; END{$a=~s/=(.*)/='\''$1'\''/; print "$a\n"}'
. Bash , , . , . , , . - , .
, , Bash ( update_gitbar hello). , , .
, , .tmux.conf setenv.
hello() {
echo hi;
}
export -f hello
hello
>>>> hi
env | sed -n '/^[^=]*hello/,/^}/p' |
perl -ne 'chomp; $a .= $a? "; $_" : $_; END{$a=~s/=(.*)/='\''$1'\''/; print "$a\n"}'
>>>> BASH_FUNC_hello%%='() { echo hi\!; }'
( >>>> , script .)