Reputation: 3657
I have looked all over but can't get anything to work for my situation.
I need to add a string to a file automatically (i.e., this will be called from a Dockerfile) but I can't figure out how to escape the special characters.
I need to add the the following exact string push!(LOAD_PATH, "/home/ngsim_env/julia/AutoEnvs")
to a file ~/.juliarc.jl
. I tried escaping all the special characters as follows:
echo "push\!(LOAD_PATH, \"/home/ngsim_env/julia/AutoEnvs\")" >> ~/.juliarc.jl
but this gives the error bash: push\!(LOAD_PATH, "/home/ngsim_env/julia/AutoEnvs"): No such file or directory
This is all taking place inside a Docker Ubuntu 16.04 container and the output of bash --version
is GNU bash, version 4.3.48(1)-release (x86_64-pc-linux-gnu)
Upvotes: 0
Views: 3521
Reputation: 446
You can try this:
echo 'push!(LOAD_PATH, "/home/ngsim_env/julia/AutoEnvs")' >> "$HOME/.juliarc.jl"
Upvotes: 3