Release Automation

Expand all | Collapse all

Tech Tip:How to run interactive command line

  • 1.  Tech Tip:How to run interactive command line

    Posted 06-19-2016 03:12 AM

    In same cases deployment tasks include execution of scripts that required user inputs through interactive prompts during the script execution.

    The following example can assist you automate similar scenarios:

    Assuming I have deployment script name "interactive.sh" which include 2 interactive questions:

    1.Confirmation for program installation

    2.Program installation path

    Example for manual installation:

    In CA RA you can use run command line action and pass the user input using echo command (\\n use for new line sequence)

     



  • 2.  Re: Tech Tip:How to run interactive command line

    Posted 10-04-2018 01:47 AM

    Hi Jacky, i am using a script where there are some menu driven steps in a script.. like 

    need to execute option 4 and 9 .. in a sequence ..

    using printf "3/n9"|./test.sh command..

    while running this command on ksh shell ,..mouse is continuously scrolling up and down and not to quit from script.



  • 3.  Re: Tech Tip:How to run interactive command line

    Broadcom Employee
    Posted 06-20-2016 09:43 AM

    That's neat, Jacky. I didn't know that. Another trick, which I'm not sure how reliable it is for use in production, might be to use/call an expect script.

     

    Cheers,

    Gregg



  • 4.  Re: Tech Tip:How to run interactive command line

    Broadcom Employee
    Posted 10-04-2018 09:21 AM

    Based on the suggestion above I believe you would maybe need to try and run (should be able to confirm by doing it manually on a machine before trying it in RA): echo "4\\n9\\n" | printf "3/n9" | ./test.sh

     

    I wonder if the printf "3/n9" portion of your command is used to specify option 3 and then 9. If so and it isn't working then maybe try it with: echo "3\\n9\\n" | ./test.sh

     

    Regards,

    Gregg



  • 5.  Re: Tech Tip:How to run interactive command line

    Posted 06-20-2016 10:10 AM

    Yes

    You can use expect command but its not part of the OS by default and required to write some scripts.