Sample Header Ad - 728x90

Parse 3rd entry in declare result

0 votes
1 answer
83 views
I have this: > cd 31 > /Users/alexamil/WebstormProjects/oresoftware/botch/botch-shell-overrides.sh the above style output, is given by this command: declare -F my_bash_func How can I grab just the file name from that result? something like: file=$(declare -F my_bash_func | grab_3rd_entry) _______________ I have to use: shopt -s extdebug declare -F my_bash_func shopt -u extdebug but this doesn't work on MacOS: shopt -s extdebug declare -pf my_bash_func shopt -u extdebug the latter yields a weird error: > declare: my_bash_func: not found but using declare -F can find the function, so not sure why the -pf option doesn't work.
Asked by Alexander Mills (10734 rep)
May 2, 2018, 04:36 AM
Last activity: May 2, 2018, 06:02 AM