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
  • 39
  • 5

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
  • 116,971
  • 11
  • 170
  • 194
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
  • 554
  • 2
  • 7
  • 20