0
votes

I have a question regarding expect, and i would like to know how to achieve this

Example scenario:

I have a command, Let's say test1, which when executed gives the below output

$./test1 --requestid 21 --file test1.xml
 Myrequestid: 21
 Profile: Test Profile
 Filename: test1.xml

 Action (update/validate): 

When the test1 is executed with options --requestid 21 --file test1.xml, creates a file test1.xml with some data related to request id 21 and also presents an interactive menu asking user to either enter update/validate.

Now the user after executing the above command, opens another terminal Edits test1.xml

Note for editing/modifying the xmlfile, i have another script so i just need to call that script.

after editing(once the script that modifies xml file) has completed, It has to return to the terminal where the above command is executed and enter update /validate at the interactive prompt to update or validate the changes.

I would like to automate this task using expect, Could some one provide hints on how best i can achieve the above using expect,

1

1 Answers

0
votes

Your question is not clear.

  • If you want your text editor to be able to notify the bash script to update or validate the file, this is not a bash-related question : you have to create a script for your text editor in the scripting language of the editor.
  • If you want your script to be able to launch a text editor (the default one for example), then let the user update/validate your file, expect is irrelevant as you have complete control over your script. You may as well ask for "update/validate/edit file", and when the user select "edit file", quit ask again "update/validate/edit file" when the user quits the editor using a loop.