I would like to copy the contents of a variable (here called var
) into a file.
The name of the file is stored in another variable destfile
.
I'm having problems doing this. Here's what I've tried:
cp $var $destfile
I've also tried the same thing with the dd command... Obviously the shell thought that $var
was referring to a directory and so told me that the directory could not be found.
How do I get around this?
See Question&Answers more detail:os