run expect script within another script
I want to run an expect script generated using autoexpect within another script,the expect script has to go into super user mode execute some commands and then exit and come back to user mode.When the script is run in the command line it works fine,i want the script to run within another script.How to go about it..?
|
Hi,
This may be easily done with sudo. But you need to have sudo set up first. I don't know off-hand how to do this without sudo, or being root. But with sudo, Code:
#!/bin/bash Hope this helps, Glenn |
here is a good su example.
su -c expect... http://www.linuxquestions.org/questi...script-396938/ cheers Glenn |
Quote:
|
Hi.
if you want to call a script from another script, just add a line (sh /absolute/address/to/script/script.name) pointing to the script from your initial script. Is that going to work for your situation? I guess you have read this, post #2 of http://www.linuxquestions.org/questi...8/#post2017678 Cheers Glenn ps. I'm still learning, :-) |
Quote:
I tried what you said stils it is not working,am getting a error syntax error near unexpected token `;' ;# script wasn't run conservatively originally' |
You'll need to debug your code.
I have many scripts that call other scripts, I try to keep them as simple as possible. Each script should work on it's own, as you said before. Make sure you are using the right kind of quoting to match your shell type. ie, zsh, bash etcetera. |
Quote:
|
All times are GMT -5. The time now is 02:46 AM. |