commit 40088fd915c966dfb38a6c271a57394f6ec54572
parent f45e8761e0e3c37cf893e5ea20935fe2ccc1e4be
Author: Cem Keylan <cem@ckyln.com>
Date: Fri, 6 Nov 2020 15:01:24 +0300
sed_i(): Return if the file doesn't exist
Diffstat:
1 file changed, 1 insertion(+), 0 deletions(-)
diff --git a/bin/muw b/bin/muw
@@ -63,6 +63,7 @@ contains() {
sed_i() {
# 'sed -i' like function without actually running it. This can be only used
# for a single file, and the filename should always come last.
+ eval "[ -f \$$# ] || return 1"
sed "$@" > _; for file; do :; done; mv _ "$file"
}