mirror of
https://github.com/bitnami/containers.git
synced 2026-03-21 07:18:22 +08:00
7.4.2-debian-9-r4 release
This commit is contained in:
22
bitnami/logstash/7/debian-9/prebuildfs/libfile.sh
Normal file
22
bitnami/logstash/7/debian-9/prebuildfs/libfile.sh
Normal file
@@ -0,0 +1,22 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Library for managing files
|
||||
|
||||
# Functions
|
||||
|
||||
########################
|
||||
# Ensure a line exists in the file by replacing a matching line.
|
||||
# Arguments:
|
||||
# $1 - filename
|
||||
# $2 - line
|
||||
# $3 - match
|
||||
# Returns:
|
||||
# None
|
||||
#########################
|
||||
file_contains_line() {
|
||||
local filename="${1:?filename is required}"
|
||||
local line="${2:?line is required}"
|
||||
local match="${3:?match is required}"
|
||||
|
||||
sed --in-place "s/^$match\$/$line/" "$filename"
|
||||
}
|
||||
Reference in New Issue
Block a user