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:
parent
d3756e162c
commit
bda440a7b3
@ -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"
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user