Merge pull request #179603 from Artturin/subplacemultiple

This commit is contained in:
Artturi 2022-07-24 04:14:09 +03:00 committed by GitHub
commit 79e8669003
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 5 deletions

View File

@ -913,9 +913,9 @@ substitute ./foo.in ./foo.out \
--subst-var someVar
```
### `substituteInPlace` \<file\> \<subs\> {#fun-substituteInPlace}
### `substituteInPlace` \<multiple files\> \<subs\> {#fun-substituteInPlace}
Like `substitute`, but performs the substitutions in place on the file \<file\>.
Like `substitute`, but performs the substitutions in place on the files passed.
### `substituteAll` \<infile\> \<outfile\> {#fun-substituteAll}

View File

@ -771,9 +771,18 @@ substitute() {
}
substituteInPlace() {
local fileName="$1"
local -a fileNames=()
for arg in "$@"; do
if [[ "$arg" = "--"* ]]; then
break
fi
fileNames+=("$arg")
shift
substitute "$fileName" "$fileName" "$@"
done
for file in "${fileNames[@]}"; do
substitute "$file" "$file" "$@"
done
}
_allFlags() {