I have the following (simplified) script
#!/bin/bash
replace(){
sed "s/$1/$2/g"
}
#first
replace "search" "replacement"
#second
replace "replacement" "again"
I want the second replace to work on the output of the first replace without reading them into a script variable so i can easily chain them further.
It works perfectly on the first pass, i assume i need to pipe or redirect the output of replace (sed) into stdin again so the second replace will be able to use it in its own sed.
Edit:
There will be an indefinite number of calls to replace and similar functions within the script. Piping the first two together does not resolve my issue as it does not scale or rather only works for a fixed number of calls.