-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathff
More file actions
executable file
·26 lines (22 loc) · 700 Bytes
/
ff
File metadata and controls
executable file
·26 lines (22 loc) · 700 Bytes
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
#!/bin/bash
# a command wrapper script: find . -type f -exec grep --color=auto -H -n "$key" {} \;
# or, with a filename: find . -type f -name "$filename" -exec grep --color=auto -H -n "$key" {} \;
# created by zhouwei on 2015-9-10
if (($# < 1)) ; then
echo "Usage: ff key [filename...]"
echo "Example: ff ConcurrentHashMap"
echo "Example: ff ConcurrentHashMap \"*.java\""
echo "Example: ff ConcurrentHashMap Test1.java Test2.java"
exit 1
fi
key="$1"
shift
if [[ "$@" == "" ]]; then
find . -type f -exec grep --color=auto -H -n "$key" {} \;
else
for file in "$@"
do
find . -type f -name "$file" -exec grep --color=auto -H -n "$key" {} \;
done
fi
exit 0