How to execute another script from sleep

13 views
Skip to first unread message

Alen

unread,
Jul 14, 2009, 4:11:21 AM7/14/09
to Sleep Developers
Hi,

I want to execute an Expect script from sleep script. So, i am using
the "exec" function as following:
$handle = exec("expect try.exp arg1 arg2 arg3 arg4'");

It runs fine if there is no whitespace in any of the arg<n>.
I want to ask how to pass the argument which has some whitespaces in
between.

For ex - if arg4 is "aa bb cc", then how to pass it in exec function.

I am passing like:
$handle = exec("expect try.exp arg1 arg2 arg3 \"aa bb cc\"'");
but the expect script treats it as 6 parameters instead of 4.

Please tell me some way to pass this kind of parameter.


Thanks in advance,
Alen

Raphael Mudge

unread,
Jul 14, 2009, 10:45:24 AM7/14/09
to sleep-de...@googlegroups.com
Hi Alen
There is a second form of exec that accepts an array where the command
and each argument is represented as an array element. This is
probably what you want as it allows you to use whitespace in each
argument.

http://sleep.dashnine.org/manual/exec.html

$handle = exec(@("expect", "try.exp", "arg1", "arg2", "arg3", "aa bb cc"));

-- Raphael

Gaurav Sharma

unread,
Jul 15, 2009, 1:15:11 AM7/15/09
to sleep-de...@googlegroups.com
Hi Raphael,

I checked the second form of exec function. It's working well for me :-)

Thanks for your suggestion.


Warm Regards
- Alen
"DISCLAIMER: This message is proprietary to Aricent and is intended solely for the use of the individual to whom it is addressed. It may contain privileged or confidential information and should not be circulated or used for any purpose other than for what it is intended. If you have received this message in error,please notify the originator immediately. If you are not the intended recipient, you are notified that you are strictly prohibited from using, copying, altering, or disclosing the contents of this message. Aricent accepts no responsibility for loss or damage arising from the use of the information transmitted by this email including damage from virus."
Reply all
Reply to author
Forward
0 new messages