bash - Usage of expect command within a heredoc -
for following tiny expect script function added bash profile:
chai() { expect <<- eof spawn ssh myuser@myserver expect ': $' send 'mypassword\r' eof }
we get:
bash: /etc/profile: line 409: syntax error: unexpected end of file
what wrong script?
i expect heredoc terminator (eof) @ start of line e.g.
chai() { expect <<- eof spawn ssh myuser@myserver expect ': $' send 'mypassword\r' eof }
i see you're using <<-
, linked doc:
the - option mark here document limit string (<<-limitstring) suppresses leading tabs (but not spaces) in output. may useful in making script more readable.
so should check script see if have tab
preceding commands. eof subject same rules.
cat <<-endofmessage line 1 of message. line 2 of message. line 3 of message. line 4 of message. last line of message. endofmessage # output of script flush left. # leading tab in each line not show.
Comments
Post a Comment