I can find plenty of answers which uses echo
, pipes |
and sed
for that purpose, but I would like to avoid them. So looking for some direct substitution.
I would like to define env var and reuse it inside the character string passed to application command line argument, i.e. Rscript -e '...'
.
Below is what I've tried without success.
Rscript -e 'cat("hello\n")'
#hello
export ASD="HELLO!"
Rscript -e 'cat("$ASD\n")'
#$ASD
Rscript -e 'cat("${ASD}\n")'
#${ASD}
Rscript -e 'cat("$(ASD)\n")'
#$(ASD)
I don't want to use echo
and |
pipes as my actual -e
argument to application is much more complex.