Skip to content

Instantly share code, notes, and snippets.

@Integralist
Created December 1, 2022 12:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Integralist/d9ba0028ce7c6b90280f73c71cb27cf5 to your computer and use it in GitHub Desktop.
Save Integralist/d9ba0028ce7c6b90280f73c71cb27cf5 to your computer and use it in GitHub Desktop.
[Write to a variable multiple times before writing to disk] #bash #shell #performance
function bar {
example=$(echo "$example" | rg $1 \
--case-sensitive \
--type go \
--type md \
--color never \
--no-line-number \
--passthru \
--replace $2)
}
function foo {
example=$(<fastly-go/go.mod)
bar "github" "GITHUB"
bar "google" "GOOGLE"
echo "$example" > final.txt
cat final.txt
rm final.txt
}
foo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment