I have this bash function that runs some Applescript. If I run the Applescript part in the Applescript Editor or in Textmate, it works fine, but on the command line, the function fails...
wtf() {
osascript - <<EOF
tell application "iTerm"
tell current terminal
launch session "Railscasts"
tell the last session
write text 'echo -ne "\\e]1;$account\\a"'
end tell
end tell
end tell
EOF
}
And the error is:
190:191: syntax error: Expected expression but found unknown token. (-2741)
I know (think) that the problem is with the first bash escape sequence on this line:
write text 'echo -ne "\\e]1;$account\\a"'
^
But I don't know why it fails... Any ideas on why this doesn't work please?
EDIT 1: I also tried this and it failed:
wtf() {
osascript - <<EOF
tell application "iTerm"
tell current terminal
launch session "Railscasts"
tell the last session
write text "echo -ne \\\"\\e]1;$account\\a\\\""
end tell
end tell
end tell
EOF
}
Error message:
163:164: syntax error: Expected end of line but found unknown token. (-2741)