bash - How can I make this pipe-able without a temp file? -


thanks elias probst's answer here, i'm using replace environment variables in text file:

target_file=/etc/apache2/apache2.conf; varname in $(grep -p -o -e '\$\{\s+\}' ${target_file} | sed -e 's|^\${||g' -e 's|}$||g' | sort -u);   sed -i "s|\${$(echo $varname)}|${!varname}|g" ${target_file}; done 

i'd alias , pipe templated file , able have replaced file written standard out. can imagine how temporary file (copy template temp file, run sed , let replace in place, cat out temp file), i'd prefer avoid that.

any hints? thank you!


Comments

Popular posts from this blog

shopping cart - Page redirect not working PHP -

php - How to modify a menu to show sub-menus -

python - Installing PyDev in eclipse is failed -