Skip to content

Commit

Permalink
if/elif bsd matcher
Browse files Browse the repository at this point in the history
  • Loading branch information
retrogradeorbit committed Jul 5, 2020
1 parent 21617d6 commit 6c39faf
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/clj/spire/module/line_in_file_present.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ if [ "$LINENUM" ]; then
fi
fi

# :present by regexp or string-match
# :present by regexp or string-match or line-match
if [ "$REGEX" ] || [ "$STRING_MATCH" ] || [ "$LINE_MATCH" ]; then
if [ "$REGEX" ]; then
LINENUMS=$(sed -n "${REGEX}=" "$FILE" | $SELECTOR)
Expand Down
10 changes: 4 additions & 6 deletions src/clj/spire/module/line_in_file_present_bsd.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,14 @@ ${SEDLINE}\\
fi
fi

# :present by regexp or string-match
# :present by regexp or string-match or line-match
if [ "$REGEX" ] || [ "$STRING_MATCH" ] || [ "$LINE_MATCH" ]; then
if [ "$REGEX" ]; then
LINENUMS=$(sed -n "${REGEX}=" "$FILE" | $SELECTOR)
elif [ "$STRING_MATCH" ]; then
LINENUMS=$(grep -n -F "${STRING_MATCH}" "$FILE" | $SELECTOR | cut -d: -f1)
else
if [ "$STRING_MATCH" ]; then
LINENUMS=$(grep -n -F "${STRING_MATCH}" "$FILE" | cut -d: -f1 | $SELECTOR)
else
LINENUMS=$(grep -n -x -F "${LINE_MATCH}" "$FILE" | cut -d: -f1 | $SELECTOR)
fi
LINENUMS=$(grep -n -x -F "${LINE_MATCH}" "$FILE" | $SELECTOR | cut -d: -f1)
fi

if [ "$LINENUMS" ]; then
Expand Down

0 comments on commit 6c39faf

Please sign in to comment.