Skip to content

Commit

Permalink
Merge pull request #3 from ioprojecton/patch-1
Browse files Browse the repository at this point in the history
Performance optimizations
  • Loading branch information
dotland authored Sep 2, 2024
2 parents d4685e7 + c7a82fa commit 49ecff4
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions linux/util.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,13 @@ section_end="< ${section_id}"


function get_line_containing() {
grep -n -m 1 "$1" "$2" | cut -f1 -d:
local -r result=$(grep -n -m 1 "$1" "$2")
echo "${result%%:*}"
}

function get_backup_file() {
local dirs="bak/$1"
local -r dirs="bak/$1"
mkdir -p $dirs
echo "$dirs/$(basename $2)"
local -r filename="${2##*/}"
echo "$dirs/$filename"
}

0 comments on commit 49ecff4

Please sign in to comment.