[Nix-dev] Escape ${ in multiline string
4levels
4levels at gmail.com
Tue Dec 29 13:35:39 CET 2015
Great, that did the trick!
To bad I couldn't find this info myself, thanks a lot for your swift
replies!
Kind regards,
Erik
On Tue, Dec 29, 2015 at 1:22 PM Bjørn Forsman <bjorn.forsman at gmail.com>
wrote:
> On 29 December 2015 at 13:05, 4levels <4levels at gmail.com> wrote:
> > Hi Nix Devs,
> >
> > I'm currently struggling to create a bash script within a nix multiline
> > string, terminted by double single quotes.
> >
> > In the bash script, I need to put ${} statements but this is throwing
> > compile errors (Undefined variable error). I've tried escaping the $
> sign
> > with a backslash, but that doesn't help. I also tried escaping with a
> > double backslash, same result.
> >
> > Any ideas? Should I rewrite the bash script to not use the ${ statements?
> >
> > Kind regards,
> >
> > code example
> > s3Backup = name:
> > ''
> > ...
> > DAILYLOGFILE="/var/log/duplicity/backup.log"
> > ...
> > # Clear the old daily log file
> > cat /dev/null > ${DAILYLOGFILE} // -> compile error: undefined
> > variable DAILYLOGFILE
> > ...
> > '';
>
> Try with two single quotes in front of ${DAILYLOGFILE}:
>
> ''${DAILYLOGFILE}
>
> It is documented here, in the "simple values" section:
>
> http://nixos.org/nix/manual/#ssec-values
>
> Best regards,
> Bjørn Forsman
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.science.uu.nl/pipermail/nix-dev/attachments/20151229/f7f0485f/attachment-0001.html
More information about the nix-dev
mailing list