-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.dot_misc
66 lines (53 loc) · 1.37 KB
/
.dot_misc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#!/bin/bash
debug_out() {
if [[ $- == *i* && $DOT_DEBUG ]]
then
echo $@
fi
}
debug_out "Processing configuration for Miscellaneous Tools"
umask 0002
function ff() {
find . -type f -iname '*'$*'*' -ls ;
}
function fd() {
find . -type d -iname '*'$*'*' -ls ;
}
function fe() {
find . -type f -iname '*'${1:-}'*' -exec ${2:-file} {} \; ;
}
list_functions() {
echo "listing functions"
for return_status in 0
do
if [[ $1 == "--help" || $1 == "-h" ]]
then
return_status=1
message="Print all the functions defined in a dot file"
message="$message\nUSAGE: ${FUNCNAME[0]} <dot_file>"
break
fi
dotfile=$1
if [[ -z $dotfile ]]
then
return_status=1
message="No dotfile supplied to find functions in"
break
fi
echo "Functions defined in $dotfile"
defined_functions=$(typeset -F | perl -pe "s/declare -f //")
for function in $defined_functions
do
line_info=$(grep -n "^$function\(\)\s*{" $dotfile)
if (( $? ))
then
continue
fi
line_num=$(echo $line_info | perl -pe "s/(\d+):.*/\1/")
echo " $function [$line_num]"
done
message=""
done
echo $message
return $return_status
}