mirror of https://xfnw.ttm.sh/git/huntnw.git
fix some bugs with manupulating strings with spaces
This commit is contained in:
parent
56e3aab304
commit
98ddad1e09
6
huntnw
6
huntnw
|
@ -1,11 +1,11 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
QUERY=`echo $1 | tr ' ' ' ' | sed 's/&/\&/g; s/</\</g; s/>/\>/g; s/"/\"/g; s/'"'"'/\'/g'`
|
QUERY=`echo $1| sed 's/&/\&/g; s/</\</g; s/>/\>/g; s/"/\"/g; s/'"'"'/\'/g'`
|
||||||
|
|
||||||
|
|
||||||
for fn in `grep -rEic $QUERY content | grep -v ':0' | sort -t: -nrk2 | awk -F: '{print $1}'`;do
|
for fn in $(grep -rEic "$QUERY" content | grep -v ':0' | sort -t: -nrk2 | awk -F: '{print $1}');do
|
||||||
PA=$fn
|
PA=$fn
|
||||||
echo "<div class='box'><a href='"`head -n 2 $PA | tail -n 1`"'>"`head -n 1 $PA | head -c 30`"</a><p>"`grep -i $QUERY $PA | sed 's/&/\&/g; s/</\</g; s/>/\>/g; s/"/\"/g; s/'"'"'/\'/g' | head -n 2 | head -c 100`"</p></div>"
|
echo "<div class='box'><a href='"`head -n 2 $PA | tail -n 1`"'>"`head -n 1 $PA | head -c 30`"</a><p>"`grep -i "$QUERY" $PA | sed 's/&/\&/g; s/</\</g; s/>/\>/g; s/"/\"/g; s/'"'"'/\'/g' | head -n 2 | head -c 100`"</p></div>"
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -12,10 +12,10 @@ Q=$(echo "$QUERY_STRING" | sed -n 's/^.*q=\([^&]*\).*$/\1/p' | sed "s/%20/ /g" |
|
||||||
if [[ $Q ]]
|
if [[ $Q ]]
|
||||||
then
|
then
|
||||||
|
|
||||||
./huntnw $Q
|
./huntnw "$Q"
|
||||||
|
|
||||||
|
|
||||||
[[ $(./tser $Q) ]] || echo "<div class='box'>No results :(</div>"
|
[ -z $(./huntnw "$Q") ] && echo "<div class='box'>No results :(</div>"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cat footer.html
|
cat footer.html
|
||||||
|
|
Loading…
Reference in New Issue