Miscellaneous improvements

This commit is contained in:
Crestwave
2019-01-19 17:20:13 +08:00
parent 2b558f2962
commit 2414ae9f42
9 changed files with 78 additions and 50 deletions

View File

@@ -167,11 +167,11 @@ printf '' >file
extract() {
# Usage: extract file "opening marker" "closing marker"
while IFS=$'\n' read -r line; do
[[ "$extract" && "$line" != "$3" ]] && \
[[ $extract && $line != "$3" ]] &&
printf '%s\n' "$line"
[[ "$line" == "$2" ]] && extract=1
[[ "$line" == "$3" ]] && extract=
[[ $line == "$2" ]] && extract=1
[[ $line == "$3" ]] && extract=
done < "$1"
}
```