OS:Ubuntu 16.04LTS. Python automation.
Hi, i am trying to do python automation in ubuntu, where i have to invoke a shell script programmatically, after invoking shell script i need to enter and execute terminal commands.
i am invoking shell script with below commands
import os
os.system("gnome-terminal --working-directory='/home/murlee/CTS/android-cts/tools' -e 'bash -c \"./cts-tradefed; exec bash\"'")
*now i need help to enter and executing terminal commands after invoking the shell script
after invoking shell script my terminal will look like this Terminal_snapshot
"murlee@murlee-Lenovo-ideapad-100-14IBD:~/CTS/android-cts/tools$ ./cts-tradefed
Android CTS 6.0_r17 build: 3866870
cts-tf >(here i have to enter commands and execute)"
Thanks!
Create an init script named my-init.sh
./cts-tradefed
Now call
import os
wd = '/home/murlee/CTS/android-cts/tools'
cmd = "bash --init-file {0}".format('./my-init.sh')
os.system("gnome-terminal --working-directory='{0}' -e '{1}'").format(wd,cmd)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.