I am writing a dockerfile and want to put the output of the \"ls\" command into a variable as shown below:
$file = ls /tmp/dir
Here, \"dir\
I couldn't get Andy's (or any other) approach to work in the Dockerfile itself, so I set my Dockerfile entrypoint to a bash file containing:
#!/bin/bash
file="$(conda list --explicit)" && echo $file
echo $(conda list --explicit)
Note the second method doesn't render line breaks, so I found the first method - echo via the $file variable - superior.