-1

I'm trying to put the result in a variable but it didn't work Syntax error: end of file unexpected (expecting ")")

#!/bin/bash
test="$(lftp -u ns454575.ip-154-145-259.eu,NGFYv85MTI ftpback-rbx2-588.mybackup.ovh.net << EOF
cd /backup/site
ls
bye
EOF)"

enter image description here

xXxlazharxXx
  • 433
  • 4
  • 8

1 Answers1

1

You shouldn't add something after here docs. You can validate this by using shellcheck.

#!/bin/bash
test="$(lftp -u ns454575.ip-154-145-259.eu,NGFYv85MTI ftpback-rbx2-588.mybackup.ovh.net <<-EOF
cd /backup/site
ls
bye
EOF
)"

p.s. you know that test is a command as well? :-)

Bayou
  • 3,293
  • 1
  • 9
  • 22