substitute: Fix "No such file or directory" message on Darwin

On Darwin, "chmod -f" does not suppress an error message if the file
doesn't exist. So just check if the file exists.
This commit is contained in:
Eelco Dolstra 2015-03-24 14:12:24 +01:00
parent d3756e162c
commit bda440a7b3

View File

@ -370,7 +370,7 @@ substitute() {
content="${content//"$pattern"/$replacement}"
done
chmod -f +w "$output" || true
if [ -e "$output" ]; then chmod +w "$output".tmp; fi
printf "%s" "$content" > "$output"
}