I want to use the "ask dialog" command to immediately pass a question. I am trying to automate the process of launching terminal and running "ask dialog". Whenever my bash script runs, it pauses once the Alexa instance opens.
#!/bin/bash/
cd /Users/AlexaDirectory/
ask dialog
#this is where I need to ask Alexa a question automatically.
#I have tried running "ask dialog && (insert question)", but the script pauses once it reaches "ask dialog"
echo "end"
Here's what i usually see when running the .sh
MacBook-Pro Desktop % bash Test.command
Defaulting locale to the first value from the skill manifest: en-US
======================================= Welcome to ASK Dialog =======================================
=========== In interactive mode, type your utterance text onto the console and hit enter ============
===================== Alexa will then evaluate your input and give a response! ======================
=== Use ".record <fileName>" or ".record <fileName> --append-quit" to save list of utterances to a file. ===
=============== You can exit the interactive mode by entering ".quit" or "ctrl + c". ================
User >
If it is not possible to pass a question immediately, would it be possible to send keystrokes to the terminal?
With help from Charles Duffy, using a herestring is the answer.
The process freezes when the ask dialog
is invoked, and the fix is sending ask dialog <<< "question for alexa placed here"
. This immediately ends the Alexa instance too.