Reorganise gists folder
This commit is contained in:
18
codegrab/depth
Executable file
18
codegrab/depth
Executable file
@@ -0,0 +1,18 @@
|
||||
#!/bin/bash
|
||||
file="${1}"
|
||||
stag="${2}"
|
||||
max=0
|
||||
open=0
|
||||
grep -Po "</?${stag}" "${file}" | while read tag; do
|
||||
if [[ "$tag" == "<${stag}" ]] ; then
|
||||
(( open++ ))
|
||||
else
|
||||
(( open--))
|
||||
fi
|
||||
|
||||
echo "$open - $max"
|
||||
|
||||
if [[ $open -gt $max ]] ; then
|
||||
max=$open
|
||||
fi
|
||||
done
|
||||
Reference in New Issue
Block a user