I set a variable in a shell script I then call a sed script and in the sed script I use the variable That does not seem to work and I needed help on how to achieve that
- Following works at the command line
sed -e "s/text/$VAR" testfile
- Following does not work
test.sh
export VAR=somevar
sed -f sedfile testfile
testfile
This is a test file
sedfile
s/text/$VAR/
Also tried
s/text/${VAR}/
Result
This is a $VAR file
Expected output
This is a somevar file