I have a Windows host with some environment variables. I would like to be able to pass them into a Vagrant linux instance to write into a file.
This works for simple values of %foo%.
vagrant ssh -c "echo %foo% | tee -a /tmp/file"
However, if %foo% has a $ in it, it messes up because linux interprets it as a variable.
Is there a way I can automagically escape any $ symbols in %foo% or get linux to not interpret it?
I had found this SO question, but it runs into the same $ problem: Pass environment variables to vagrant shell provisioner
Simply quote it with single quotes:
vagrant ssh -c "echo '%foo%' | tee -a /tmp/file"
I just hope %foo%
doesn't expand to something that has single quotes as well.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.