Hi; problem may be obvious, simple but I have to say it is somehow not easy to locate the issue.
I am doing some word extracting from multiline text.
Interacting in CLI seems to work without issues. First step is to add multiline text to a variable.
expect1.1>
expect1.1> set multilinetext "first one two\nsecond one two three\nthird one\nfourth one two three four\nfifth one two"
first one two
second one two three
third one
fourth one two three four
fifth one two
expect1.2>
But I tried that inside script, no result, always getting error messages. Here are 5 attempts.
#!/bin/bash
expect -c "
set multilinetext \"first one two\\nsecond one two three\\nthird one\\nfourth one two three four\\nfifth one two\";
# multilinetext=\"first one two\nsecond one two three\nthird one\nfourth one two three four\nfifth one two\";
# set multilinetext 'first one two\nsecond one two three\nthird one\nfourth one two three four\nfifth one two';
# set multilinetext \"first one two\nsecond one two three\nthird one\nfourth one two three four\nfifth one two\";
# set multilinetext "first one two\nsecond one two three\nthird one\nfourth one two three four\nfifth one two"
;"
Errors are from the:
wrong # args: should be "set varName ?newValue?"
while executing
To the:
couldn't read file "one": no such file or directory
And this is just the first step. Have to ask if somebody has correct command and explanation.
Thank you.