vscodium/utils.sh

31 lines
443 B
Bash
Raw Normal View History

#!/bin/bash
# All common functions can be added to this file
2022-08-16 14:51:45 +03:00
exists() { type -t "$1" > /dev/null 2>&1; }
is_gnu_sed () {
sed --version >/dev/null 2>&1
}
replace () {
echo "${1}"
if is_gnu_sed; then
sed -i -E "${1}" "${2}"
else
sed -i '' -E "${1}" "${2}"
fi
}
2022-08-16 14:51:45 +03:00
if ! exists gsed; then
if is_gnu_sed; then
function gsed() {
sed -i -E "$@"
}
else
function gsed() {
sed -i '' -E "$@"
}
fi
fi