1

An example of what I'm trying to achieve:

echo "BSPDIR := "${@os.path.abspath(os.path.dirname(d.getVar('FILE', True)) + '/..')}"" >> somefile.txt

I want the whole text in the outermost quotes inside "somefile.txt", and not have to modify it with escape sequences. I don't mind using something else other than echo.

I appreciate any input. ;-)

Leon Held
  • 37
  • 4

2 Answers2

3

You can use a "here document":

cat >> somefile.txt << "EOF"
BSPDIR := "${@os.path.abspath(os.path.dirname(d.getVar('FILE', True)) + '/..')}"
EOF
that other guy
  • 109,738
  • 11
  • 156
  • 185
0

One simple thing you can do is to use single quotes. This way, the special characters will be considered as literal ones. Have a look at here.

echo 'BSPDIR := "${@os.path.abspath(os.path.dirname(d.getVar('FILE', True)) + '/..')}"'
nino
  • 454
  • 2
  • 4
  • 15