Currently my ZSH has some sourced functions, for instance:
% declare -f
... a lot of shell functions appears here.
I'm currently writing a shell script that will call a specific function from that list (prompt_dir
from Powerlevel9k's theme for Oh-My-Zsh).
My script is:
#!/bin/zsh
echo_prompt_segment(){
# bunch of source-code here
}
zsh_oddeven_dir(){
prompt_dir echo
}
zsh_oddeven_dir
Problem is that my script cannot access these functions:
% ./oddeven-pwd.sh
zsh_oddeven_dir:1: command not found: prompt_dir
When I do declare -f
from inside the script, there are only those two functions that's inside my script:
% ./oddeven-pwd.sh
echo_prompt_segment () {
}
zsh_oddeven_dir () {
declare -f
}
Can I access and run those functions that were declared above my script? If so, how?