How can I write in a shell setup with a script?
I want to automate my installation of teamviewer. I can set up teamviewer using the command teamviewer setup
which runs in the gnome shell and asks me for the credentials. I would like to be able to automate this in a script and not have to enter the credentials by hand.
I have already use command like:
$ printf "xxxxx\nxxxx" | teamviewer setup
But didn't work.
Any solutions ?
teamviewer setup command
My problem was solved by the tool advised by raj. Thanks to him ! This tool is "Expect". https://linux.die.net/man/1/expect
Expect is a program that "talks" to other interactive programs according to a script. Following the script, Expect knows what can be expected from a program and what the correct response should be. An interpreted language provides branching and high-level control structures to direct the dialogue. In addition, the user can take control and interact directly when desired, afterward returning control to the script.
Example: (In my case)
#!/usr/bin/expect
spawn teamviewer setup
expect "username:"
send "xxxxxx\r"
expect "password:"
send "xxxxxx\r"
wait