X-Git-Url: https://ruderich.org/simon/gitweb/?p=config%2Fdotfiles.git;a=blobdiff_plain;f=lib.sh;fp=lib.sh;h=7b76a7cab66b08cad1d639f0c059fae2dc637798;hp=204a8e9f95a2e695c4822682f85de7bf6cb1727c;hb=f2ae0a2fdd20981164c1a10b0be4c354234610b0;hpb=d833e9f69422ab8702f877886bc30324a7787d3a diff --git a/lib.sh b/lib.sh index 204a8e9..7b76a7c 100644 --- a/lib.sh +++ b/lib.sh @@ -50,6 +50,21 @@ installed_path() { ) } +# Usage: sed_i ... +# +# Uses .tmp as temporary file. sed -i is not compatible due to different +# implementations. +sed_i() { + # Get last argument. + last= + for x; do + last="$x" + done + + sed "$@" >"$last".tmp + mv "$last".tmp "$last" +} + # Print the current OS. The following OS are supported at the moment: # - Debian (debian) # - Gentoo (gentoo)