Skip to content
Karl Dahlke edited this page Aug 3, 2020 · 3 revisions

list the function sin your config file.

The following bash script lists the functions in your config file, including a comment line if one is provided. You can run it any time, or you can run it and read the output into a buffer from your init script, if you always want the list on-hand.

#!/bin/bash
#
# list functions of Edbrowse config file
# with, if it exist, the explanation line 
#
n=0
prec=0
rm -f /tmp/listef.txt
while read line
do
    n=$((n+1))
    if [[ $line =~ ^function[:+] ]] ; then
        l2=${line/function[+:]/}
        l2=${l2/{/}
        prec=$((n+1))
    fi
    if [[ $n -eq $prec ]] ; then
        if [[ $line =~ ^# ]] ; then
            echo $l2$line >> /tmp/listef.txt
        else
            echo $l2 >> /tmp/listef.txt
        fi
    fi
done < ~/.ebrc